RegionManager.Regions never contains my ChildWindow regions

I'm trying my best to make it work. Basically I have a Silverlight application using a combination of MVVM / PRISM / Unity.

My shell consists of two regions: RootContent and RootMenu . My RegionManager.Regions is able to see these two areas perfectly, and the application works correctly.

The problem starts when one of my views inside RootContent opens a ChildWindow , it contains more than two regions, as shown below:

 <ContentControl Region:RegionManager.RegionName="WOFSCustomerLookup" /> <ContentControl Region:RegionManager.RegionName="WOFSCustomerView" /> 

The ViewModel of this view, which has this XAML above, even inherits and is correctly resolved, the IRegionManager.Regions collection IRegionManager.Regions not contain these two new Regions above, only RootContent and RootMenu.

Additional Information

This is how My ChildWindow is called (it calls "View"):

 ChildWindow editor = this.container.Resolve<WorkOrderFieldServiceEditor>(); editor.show(); 

And this is the constructor of my ViewModel model:

 public WorkOrderFieldServiceViewModel(IUnityContainer container, IRegionManager regionManager) { this.container = container; this.regionManager = regionManager; // Still have just the two Root regions: // this.regionManager.Regions[] } 

Did I miss something?

+4
source share
1 answer

Quite precisely, the problem is that you are not showing the WorkOrderFieldServiceEditor view through Prism, but just getting an instance of it through the container and then calling the Show method directly on it. So, Prism is not really involved. When the main shell is created through the bootloader, then the regions defined in the view are then created in the area manager. This way, you will need to see how you go to the popup using Prism and not call the Show method directly.

Check out the RegionPopupBehaviors.cs file in the StockTrader help application.

http://msdn.microsoft.com/en-us/library/ff921074(v=PandP.40).aspx

+1
source

Source: https://habr.com/ru/post/1380247/


All Articles