Close View from ViewModel thru Region?

Topics: Prism v4 - Silverlight 4
May 11, 2011 at 2:35 PM

Hello I am using View-Based navigation to populate views in various regions.

I want to be able to close the View from its ViewModel via the RegionManager without explicit reference of the View in the ViewModel and vice versa.

How can this be achieved?

I think the INavigationAware interface should have had an event Close to notify the RegionManager.

I prefer to not imlpement new interface and other contract that are not out the box (I said I prefer, if there is no other way, I am gonna have to do it).

May 11, 2011 at 4:14 PM


Views can be removed from any place if you have access to the RegionManager and the name for identifying a particular view. This means that you could avoid removing views from its ViewModel if you want.

In the Stock Trader RI, views are removed from a Controller class. If you need more guidance on this topic you could take a look at the following Reference Implementation Application: Stock Trader Reference Implementation, see the OrdersController class in the StockTraderRI.Modules.Position project.

I hope you find this information useful.


Miguel Bronzovic