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

New Post: Scoped Region Manager

$
0
0
Hi,

First of all, when you inject a view with a scoped RegionManager (using the Add method as you mentioned above,) the newly created RegionManager is stored inside an attached property put in the injected view. For example, if you inject the tabItemView with an scoped RegionManager, said RegionManager will be put in a "RegionManager" attached property in the tabItemView. Also, in Prism, all regions have a reference to their corresponding RegionManager (if any,) so when the scoped regions in the tabItemView are created they will have a reference to the scoped RegionManager too.

There is no specific method to access the scoped RegionManagers created in your application. If you have a Region that is registered in that RegionManager you can obtain it from its RegionManager property. If you have a reference to the view, you can obtain it from its attached property using the GetRegionManager method:
IRegionManager rm = RegionManager.GetRegionManager(tabItemView);
Also, if you wish to access the scoped RegionManager in the view models that are injected in the scoped regions, I believe you could find the RegionManagerAwareBehavior included in the following blog post useful:
Finally, the last question is related to how the memory is managed in a .NET application. Basically, when there is no strong reference that keep the RegionManager alive, it will be marked to be garbage-collected. However, that RegionManager will only be destroyed when when the garbage-collector is run.

I hope this helps,

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

Viewing all articles
Browse latest Browse all 1878

Trending Articles



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