I am working on a very large application using WPF, PRISM v4 and Unity.
The application is broken into several areas, each area has its own Scoped RegionManager.
After the Modules initialization I can see all the RegionManagers and all of them have all their defined regions and views.
When I activate one of the Views, which is the root of a Scoped RegionManager, some of the regions in that RegionManager are removed and I can't navigate to them.
I subscribed to the RegionManager.Regions.CollectionChanged event for the specific Scoped RegionManager and I see in the event callback callstack that it is originating from RegionManagerRegistrationBehavior.TryRegisterRegion, but I can't figure out what's causing the region to be removed.
I add every Scoped RegionManager that I create to the Unity Container for resolving it when needed during navigation, and I also call the RegionManager.SetRegionManager for each view.
The views are added to the regions using region.Add(view, name).
I'll try to give an outline of the Regions and Views in play:
MainView
-ViewA - Scoped RegionManager root view
---Region1
-----ViewB
-------Region2 -> This region is removed
----------ViewC - These 2 views are injected to this region
----------ViewD
ViewA has 2 instances, which is why a Scoped RegionManager is needed, the same view is injected to 2 regions (in the Main view above it) and shown in different areas of the application.
This problem is a little complicated to explain, but I hope someone can understand what I'm trying to show here.
Any help would be appreciated