来自没有文件的字符串的动态内联 silverlight
对于我在大学的最后一个项目,我正在使用 ASP.NET MVC3 进行开发,并使用 silverlight 进行矢量图形。
我将 silverlight 代码作为 string/xml 存储在数据库中,并且希望能够动态操作它(更改比例等)并将其显示在我的 aspx 视图中。由于可扩展性问题(会有很多文件)以及可能将应用程序移植到云(Azure),我不想也不能使用文件。
基本上我想构建一个控制器,它将从数据库获取原始 xaml 代码并显示它。我在网上找到的所有解决方案都是关于两个对我没有帮助的选项:
http://msdn.microsoft.com/en-us/library/cc189044(VS.95).aspx - 这涉及手动创建整个 dom 对象并将其集成到现有的 silverlight 页面,我没有
http: //visualstudiomagazine.com/articles/2008/01/21/using-inline-xaml-with-silverlight-listing-2.aspx - 在 html 本身中使用嵌入式标头 - 再次不切实际..
也许有人可以建议我一个实用的我的问题的解决方案
for my final project in university i am developing in asp.net mvc3 and using silverlight for vector graphics.
I store silverlight code as string/xml in a database, and i want the ability to manipulate it dynamically (change proportions etc..) and display it in my aspx view. i don't want and can't use files because of scalability issues (there will be a lot of them) and because of possible porting of the application to the cloud (Azure).
basically i want to build a controller that will take raw xaml code from the DB and display it. all the solutions i found on the web are about two options which is not helpful for me:
http://msdn.microsoft.com/en-us/library/cc189044(VS.95).aspx - which involves manually creating the entire dom object and integrating it in an existing silverlight page, which i don't have
http://visualstudiomagazine.com/articles/2008/01/21/using-inline-xaml-with-silverlight-listing-2.aspx - using embedded header in the html itself - again not pracrtical..
maybe someone can suggest me a practical solution for my problem
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我建议您花一些时间详细研究如何使用 Silverlight 导航框架。
我认为您应该能够将
Frame
元素与分配给其ContentLoader
属性的您自己的INavigationContentLoader
实现一起使用,并且可能是您自己的派生产品将UriMapperBase
分配给其UriMapper
属性。然后,您将使用如下 URL:-
您将有两个视图,“yourHost”将简单地生成托管您将构建的 Silverlight 应用程序所需的 HTML。 “yourXaml”视图将简单地提供原始 Xaml。
您的 Uri 映射器将采用 # 之后提供的相对 url(这就是 silverlight 应用程序内导航的工作原理)并创建一个可以指向您的 Xaml 控制器的 Uri。
然后,您的
INavigationContentLoader
实现将从 Uri 中获取 Xaml 并加载它。假设 Xaml 包含使用“/yourXamlController/otherReference”等 url 的超链接。您应该能够在存储的 Xaml 中导航,而无需重新加载 Silverlight 应用程序。一切都与引用和下载新的 Xaml 块有关。
I would suggest the you spend sometime examining in detail how the Silverlight navigation framework can be used.
I'm think you should be able to use the
Frame
element with your own implementation ofINavigationContentLoader
assigned to itsContentLoader
property and possibly your own derivative toUriMapperBase
assigned to itsUriMapper
property.You would then use a URL like this:-
You would have two views, "yourHost" would simply generate the HTML nececessary to host the Silverlight application you will build. The "yourXaml" view would simply serve up the raw Xaml.
Your Uri mapper will take the relative url supplied after the # (this is how silverlight intra-application navigation works) and create a Uri that can points at yourXaml controller.
Your implementation of
INavigationContentLoader
will then fetch the Xaml from the Uri and load it up.Assuming the Xaml contains hyperlinks to using urls like "/yourXamlController/otherReference". You should be able to navigate around your stored Xaml without reloading the Silverlight app. Everything will be about referencing and downloading new chunks of Xaml.