Nested regions

Topics: Prism v2 - Silverlight 2, Prism v2 - Silverlight 3, Prism v2 - WPF 3.5
Sep 22, 2009 at 9:15 AM

Hi guys,

Looking through the Prism documentation and samples, the first thing that comes to mind are nested regions. For example, if a view was loaded into "MainRegion", can that view contain other regions that other views can be registered into. I seems like it would be possible, based on the implementation of dependency properties (assuming your region names are unique).

Are there any issues/gotchas with this approach, particularly relating to when the child-view (containing the sub-regions) is unloaded? Or am I simply describing exactly how Prism is intended to be used?

Richard

Sep 22, 2009 at 4:41 PM

That is how it works (Scoped Regions) but a gotcha that I am working with right now is when you want to load the same control (different instances) into the same region. I have found that doing this with Unity and Prism in the mix is quite a challenge to get right without some workarounds. Using constructor injection and getting the region manager correct in the child windows is a chicken / egg problem!

Jan 1, 2010 at 8:13 AM

hi fred , did u happen to solve the problem , i want my presentationModels to be injected with the scoped region manager and my popup region adapter should also find the scoped region manager to add the region to.  any help will be highly appreciated.

Jan 1, 2010 at 5:24 PM

I did get something working but not really to my satisfaction and so I gave up on finding one at that time (just a demo prototype that was "good enough"). Basically I was using the Microsoft.Practices.Composite.Presentation.Regions.RegionManager.SetRegionManager(...) method to set the region manager that the scoped method returned BUT of course as the message above indicated, I was always running into something not quite right such as something NULL or the XAML binding not finding what it needed.