Silverlight 复合应用程序

发布于 2024-11-19 23:21:10 字数 488 浏览 3 评论 0原文

我正在尝试找出解决我面临的问题的最佳方案。我有一个 Silverlight 应用程序,它应该由不同的模块组成。我可以使用 Prism,放置区域并加载模块并用加载的模块填充区域,但这在我的情况下还不够。这就是我想要完成的任务:

  • 对于从不同 xap 文件加载的大多数视图,我应该在 shell 中的某个位置放置一个元素,这将执行到动态加载视图的导航。
  • 该元素(链接到动态加载的视图)应该支持本地化,并且应该具有可动态分配的数据模板,不同的模块链接应该具有不同的内容/数据模板(我正在考虑在服务器上的 xaml 文件中编写数据模板并从 silverlight 读取它们)通过 XamlReader,也许有更好的方法?)。
  • Uri 映射和浏览器日志应与导航配合使用。 Silverlight 默认导航机制比 Prism 中的导航机制更适合我的需求。
  • 该架构应支持 MVVM。

我想仅此而已。我只是想不出一个好的架构可以满足我所有的需求。任何帮助将不胜感激。

I'm trying to figure out what would be best solution to the problem I'm facing. I have a Silverlight application which should be composed from different modules. I can use Prism, place regions and load modules and fill regions with loaded modules but this is not enough in my situation. Here's what I want to accomplish:

  • For most views that gets loaded from different xap files, I should place an element somewhere in the shell, which will perform navigation to the dynamically loaded view.
  • That element (which links to dynamically loaded view) should support localization and should have dynamically assignable data templates, different module links should have different content/data template (I'm thinking writing data templates in xaml files on the server and reading them from silverlight via XamlReader, maybe there's a better way?).
  • Uri mapping and browser journal should work with navigation. Silverlight default navigation mechanism better suits my needs than the one found in Prism.
  • The architecture should support MVVM.

I think thats all. I just couldn't think of a good architecture which will satisfy all my needs. Any help would be greatly appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

墟烟 2024-11-26 23:21:10

我不知道有哪个产品/解决方案可以满足您的所有要求,因此这里对每个产品/解决方案进行一些评论:

  1. 如果 shell 的一个区域有一个支持多个项目的区域,您只需注册一个链接/按钮等类型的控件每个模块中具有相同的区域名称。例如,我们基于 Telerik TadRibbonTab(而不是 UserControl)向名为“views”的区域注册视图,该区域是一个带有名为“views”的区域的 RibbonBarTab。然后,每个模块将其自己的按钮添加到列表中。您可以对任何多项目容器执行相同的操作。
  2. 本地化是一个完全不同的问题,可以通过多种方式解决。请在此处查看我的答案:从 Silverlight 中的文件夹加载资源“.resx”
  3. 可以使自定义导航映射器的行为与标准导航映射器类似,而不会破坏对 Prism 区域的支持。我们创建的将 GUI 信息(例如当前选择(当前视图和项目选择等))编码到 URL 中。这意味着我们完全控制状态并且 URL 控制状态。
  4. 几乎没有什么可以阻止您使用 MVVM,因为这是将视图与代码隐藏数据分离的一个小功能。

我会对提出的其他解决方案感兴趣,因为我们也一直在寻找新的想法。

I do not know of a single product/solution that would cover all your requirements, so here are some comments on each:

  1. If one area of the shell has a region that supports multiple items, you just register a control of type link/button etc with the same region name in each module. For example we register views based on the Telerik TadRibbonTab (instead of UserControl) with a region named "views" which is a RibbonBarTab with a region named "views". Every module then adds its its own button to the list. You can do the same thing with any multi-item container.
  2. Localisation is a completely different issue and can be solved in a number of ways. See my answer here: Load Resources ".resx" from folder in Silverlight
  3. A custom navigation mapper can be made to behave like the standard one, without messing up the support for Prism regions. The one we created encodes GUI information such as current selections (current view and item selections etc) into the URL. That means we are in total control of the state and the URL controls the state.
  4. Hardly anything stops you using MVVM as that is one small feature for separating views from code-behind data.

I will be interested in what other solutions are proposed as we are always looking for new ideas too.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文