We have seen how Radical Presentation resolves views instances at runtime and we have told that during the resolution process we inject/attach to the resolved view some behaviors using a convention.

The convention attaches the following behaviors to each resolved view:

  • to every view (every DependencyObject) attaches the “DependencyObjectCloseHandlerBehavior” whose role is to allow the view model to send a close request message to its own view without the need to handle a reference to the view;
  • if the view is a window attaches the “WindowLifecycleNotificationsBehavior” used to notify to the view model the lifecycle state changes of the view (loaded, shown, activated, closing and closed);
  • “else if” the view is a FrameworkElement attaches the “FrameworkElementLifecycleNotificationsBehavior” whose role is notify to the view model when the view is loaded;

The easiest way to handle view lifecycle state changes in the view model is to setup a callback expectation.

Last edited Nov 6, 2012 at 12:25 PM by topics, version 2

Comments

No comments yet.