Local regions

Topics: Prism v4 - WPF 4
Aug 17, 2011 at 8:41 AM

How can I make two different modules have been in the region with the same name, and each of these regions was local to their unit?

Aug 17, 2011 at 9:46 PM

Based on my understanding of your requirement, you should use scoped regions so that each view gets its own RegionManager and its regions will be registered with that RegionManager instead of with the parent RegionManager. You'll find more information regarding this in the Prism Composing the User Interface chapter.

Please let me know if I understood you scenario incorrectly.


I hope you find this helpful.

Agustin Adami

Aug 18, 2011 at 12:03 PM

I think that's what I want, but it does not work.

There is a working example that demonstrates what you have written here and
Composing the User Interface "Parent and scoped RegionManagers"?

Aug 18, 2011 at 5:33 PM

I need something like this:

There are two module Module1 and Module2, each region has one named Region1.

There is a third module Module3, it is a representation of it here and then I need to add to the regions in both Region1 module Module1 and Module2.

I want to add a attribute to the view, for example:

[ViewExport(RegionName = RegionNames.Region1)]
public partial class MyView : UserControl, IMyView

How can I do this?

Aug 19, 2011 at 3:23 PM


We've created a sample application in which two views (View1 and View2) that contain a region with the same name are injected in the MainRegion using the scoped regions approach. After that another view (HelloWorldView) is registered in that NestedRegion causing it to be shown in both views.

You can find the sample in my skydrive account, under the ScopedRegionsSample name.

Also you might find more samples in the UI Composition Lab (exercise 3) in the Prism Training Kit; note that this lab is using Unity, but the concepts explained there are still useful.

I hope you find this useful.

Agustin Adami

Aug 21, 2011 at 1:27 PM

aadami, Thank you very much.