I'm a bit of a PRISM newbie, but I've read the help documentation and can't seem to find out how to achieve the following (this is a WPF application)
I have a Shell
(Window) that has 2 regions called 'region1' and 'region2'.
in the Initialize
method of my one and only module, I am registering the same view with each region:
regionViewRegistry.RegisterViewWithRegion("Region1", typeof(View1));
regionViewRegistry.RegisterViewWithRegion("Region2", typeof(View1));
and when I run it everything is OK at this point as it creates 2 individual instances of View1
, and places one in each region.
Now in View1
I have declared its own region for injecting small child views
<ItemsControl Name="MainRegion" cal:RegionManager.RegionName="MainRegion" />
Now when I run my very simple PRISM app I get the following exception message:
"Region with the given name is already
registered: MainRegion"
which suggests that I cannot have multiple instances of the same view if that view declares its own regions.
Is this correct ?
seems like a huge limitation.
I want my application to be highly modular, and to have view compose themselves of oother views (via regions) etc.
Or have I mis-read the documentation?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…