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

New Post: What would be the best practice to remove a view from a region?

$
0
0
Hi,

As far as I know, there are two possible ways to remove a view from your Region, both of which are correct:
  • Use the Remove method on a Region passing the view you want to remove as a parameter (as you are already doing)
  • Make your views implement IRegionMemberLifetime and change the KeepAlive property to return false. This way, next time you want to remove a view, you could call the Deactivate method instead, so your view will be first deactivated and then, since KeepAlive is set to return false, removed.
Nevertheless, taking into account the context of your application, the commonly used method is to implement IRegionMemberLifetime on your Views/ViewModels. Basically, when you navigate to a view, the previous activated view will be automatically deactivated and therefore removed thanks to the IRegionMemberLifetime, without the need to do it manually.

You could find more information about this in the following section of the Prism documentation:
Hope this helps,

Federico Martinez
http://blogs.southworks.net/fmartinez

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>