我曾经尝试过一段时间来让它正常工作。基本上,我有一个使用MVVM/PRISM/Unity组合的Silverlight应用程序。
我的外壳由两个区域RootContent
和RootMenu
组成。我的RegionManager.Regions
能够很好地看到这两个区域,应用程序运行正确。
问题在于当我的RootContent
中的一个视图打开一个ChildWindow
时,它包含了另外两个区域,如下所示:
<ContentControl Region:RegionManager.RegionName="WOFSCustomerLookup" />
<ContentControl Region:RegionManager.RegionName="WOFSCustomerView" />
这个View的ViewModel,即使继承并正确解析了上面的XAML,IRegionManager.Regions
集合仍然不包含上述两个新区域,只有RootContent和RootMenu。
更多信息
这是我的ChildWindow如何被调用的(它调用了“View”):
ChildWindow editor = this.container.Resolve<WorkOrderFieldServiceEditor>();
editor.show();
这是我的ViewModel的构造函数:
public WorkOrderFieldServiceViewModel(IUnityContainer container, IRegionManager regionManager)
{
this.container = container;
this.regionManager = regionManager;
// Still have just the two Root regions:
// this.regionManager.Regions[]
}
我有遗漏什么吗?