Quantcast
Channel: patterns & practices: Prism
Viewing all articles
Browse latest Browse all 1878

New Post: Application with more than one Shell or Popup Windows with regions inside it

$
0
0
Hi,

Based on my understanding, you should be able to create a new Shell in your application at any time by following the same steps that the bootstrapper does to create the main Shell:
  1. Create a Shell instance using the container.
  2. Set the corresponding RegionManager using the SetRegionManager method.
  3. Invoke the UpdateRegions method to register the regions in the RegionManager.
Brian has made a good remark in pointing that your view model should not create a Shell (or any other view) directly. Therefore, you could define a simple service that could be consumed by the view models and that would execute the aforementioned steps to create the Shell. It could also contain any logic to manage those windows, if needed. Besides the RegionManager, the rest of the services provided by Prism, such as the EventAggregator or the ModuleManager, are independent of the UI / Regions of the application, so you should be able to use them in all the windows without problems.

Regarding the regions of the secondary Shells, if your application will have several windows or will reuse views in different Shells, then I believe it could be appropriate to use an scoped RegionManager for each Shell to avoid conflicts between region names (you can obtain a new RegionManager using the CreateRegionManager method.) Take into account that the container only has the RegionManager of the main Shell registered; therefore, you will need to manage the access to the scoped RegionManagers of the secondary windows.

Also, in order to access the appropriate RegionManager for a view depending on the Shell it's being shown on, you might find the RegionManagerAwareBehavior described in the following blog post useful:
I hope this helps,

Damian Cherubini
http://blogs.southworks.net/dcherubini

Viewing all articles
Browse latest Browse all 1878

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>