Region not found

Topics: Prism v4 - WPF 4
Jun 28, 2011 at 4:24 PM
Edited Jun 28, 2011 at 4:26 PM


I have a Shell which contains one region "MainRegion" as shown below.


<!-- Shell -->
<Window x:Class="PrismLearning.Shell"
<ContentControl x:Name="ContentView" prism:RegionManager.RegionName="MainRegion"/>



Then I have one View "CustomerMainView" which successfully loads into "MainRegion" as shown below. The "CustomerMainView" has only one region named "CustomerRegion"


<!-- CustomerMainView -->
<UserControl x:Class="CustomerModule.CustomerMainView"
<ItemsControl prism:RegionManager.RegionName="CustomerRegion"/>



Now when I try to load a view into "CustomerRegion" above, I get region not found error in RegionManager. Here is the relevant code that tries to load view the in "CustomerRegion"


            CustomerViewModel custViewModel = 



Any idea why the "CustomerRegion" is not populated in the Regions property of RegionManager?



Jun 28, 2011 at 6:19 PM
Edited Jun 29, 2011 at 2:27 PM

Hi Nirvan,

We've examined the repro sample you've uploaded (in this thread), and found that your issue could be happening because you're defining your region inside a DataTemplate. Currently, regions defined inside DataTemplates aren't added to the RegionManager, because the FindRegionManager method in the RegionManagerRegistrationBehavior cannot locate the RegionManager attached property in DataTemplates (possibly due to the fact that they have no parent in the logical tree).

You can find more information on the subject in the following thread:

I hope you find this helpful.

Guido Leandro Maliandi