Search This Blog

Thursday, September 1, 2011

Control opening Views in PRISM - Single instance or opening many separate instances of the view in one region; Single instance views in PRISM; Silverlight

Controlling the bahaviour of the view (Single instance View or many separate instances) can be done from IsNavigationTarget method from INavigationAware interface.
This method returns Boolean value.

true - opens Single instance of the view
false - opens many separate instances of the view in one region


public class SomeViewModel : NotificationObject, IConfirmNavigationRequest, ITabbedContent
{

......

  bool INavigationAware.IsNavigationTarget(NavigationContext navigationContext)
  {
      return true; //Opening Single instance of the view
  }

......

}

No comments:

Post a Comment

If you like this post, please leave a comment :)