Change number of regions in Prism Shell

353 Views Asked by At

enter image description here

Hi I am Using Prism 6 with unity. and navigation Similar to here

I want to change the number , shape and size of regions in my shell after user crosses a certain checks in my WPF app.for that I am using Data Template Selector in shell. 1. Left side in image shows my application layout initially. [DataTemplate1] 2 Right side in image shows my application layout after some authentication[DataTemplate2]. 3.In Shell.xaml.cs I am changing a flag(after authetication)and with help of Event aggregator, my Template selector returns proper template.[DataTemplate2] 4. Here when in oneModule I am Trying use region defined in my DataTemplate2 I am getting an Exception.(Which was otherwise working fine, without using templates in shell) IRegion mainContentRegion = this._regionManager.Regions[RegionNames.MainContentRegion];

An exception occurred while trying to create region objects. - The most likely causing exception was:'System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> Prism.Regions.Behaviors.RegionCreationException: An exception occurred while creating a region with name ''. The exception was: System.ArgumentNullException: Value cannot be null

Update1>> As i mentioned earlier I am using navigation sample provided here. here. when i debug it I found that just before navigation the region manager has few regoins in normal case enter image description here but in my case (after templating shell) the region manager collection is empty(enumeration yeilded no results) I believe i need to fix my region collection after templating shell my region manager region collection getting reset. I need advice someone who is expert in Prism.

0

There are 0 best solutions below