MEF:一个区域,多个视图同时显示
我正在尝试构建一个包含外壳应用程序和后续模块的模块化应用程序。我想为模块定义一个导航区域来显示超链接按钮。我在 shell 视图中将此区域称为“NavigationRegion”:
<ItemsControl Name="NavigationRegion" prism:RegionManager.RegionName="NavigationRegion" />
在每个模块的初始化方法中,我调用导航区域的 add 方法:
public void Initialize() {
regionManager.Regions["NavigationRegion"].Add(new Views.Navigation());
}
使用 AggregateCatalog.Catalogs.Add 方法将模块全部加载到引导程序中:
this.AggregateCatalog.Catalogs.Add(new AssemblyCatalog(typeof(Orders.OrderModule).Assembly));
this.AggregateCatalog.Catalogs.Add(new AssemblyCatalog(typeof(People.PeopleModule).Assembly));
问题是,仅显示一个视图,并且它是添加到目录视图中的第一个部件。那么如何让添加到导航区域的所有视图都显示出来呢?或者我应该使用其他方法来同时显示所有视图?
I'm trying to build a modular application that contains the shell application and subsequent modules. I'd like to define a navigation area for modules to display a hyperlink button. I've called this region 'NavigationRegion' in the shell's view:
<ItemsControl Name="NavigationRegion" prism:RegionManager.RegionName="NavigationRegion" />
Inside each module's initialize method, I'm calling the navigation region's add method:
public void Initialize() {
regionManager.Regions["NavigationRegion"].Add(new Views.Navigation());
}
The modules are all loaded in the bootstrapper using the AggregateCatalog.Catalogs.Add method:
this.AggregateCatalog.Catalogs.Add(new AssemblyCatalog(typeof(Orders.OrderModule).Assembly));
this.AggregateCatalog.Catalogs.Add(new AssemblyCatalog(typeof(People.PeopleModule).Assembly));
The problem is, only one of the views shows up and it is the first assembly that was added to the catalog's view. So how do I get all the views added to the navigation region to show up? Or is there some other method I should be using to show all the views at the same time?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
ItemsControl 需要一些东西来告诉它显示多个项目:
The ItemsControl needs something to tell it to display multiple items: