NavigationFrame's and PartialView's

Navigation in Phoenix is based around two controls, the NavigationFrame and PartialView controls. The best way to think about these controls are they are basically content controls that support navigation forward, and the navigation frame also keeps a journal of past content and can navigate back.
I will explain everything in the context of NavigationFrames, because PartialViews are the same, except they cannot navigate backwards.


Activated/Deactivated events on ViewModel's

When a view is displayed in a NavigationFrame, the activated method will be called on the ViewModel if it inherits from ViewModelBase so give you a change to do any setup, subscribe to event aggregator events, or Rx data sources etc.
When the Navigation frame navigates forward to another view, the deactivated event will be called.
    public class HomeViewModel : ViewModelBase
        protected override void OnActivated()


        protected override void OnDeactivated()


Memory Efficient Mode (API not public yet..)

Phoenix can be told to be efficient with it's memory usage, this allows views/viewmodels on the back stack of the NavigationFrame to be Garbage Collected! When the navigation frame navigates back to a View, and it has been garbage collected the navigation frame will re-invoke the controller action that created the view, then will restore any transient state the viewModel has. To mark a property as transient state simply put Transient(()=>MyProperty) in your viewmodel's constructor. See WP7 Lifecycle Support for more information.

This is really handy for WP7 apps which have a small memory limit (90mb), or for WPF apps which have large complex views, or are very navigation heavy and want to keep their memory usage down.

Transitions Support

Phoenix has full support for transitions in both WPF and WP7, though the markup used is slightly different (due to the different platforms setup). The main difference is for WP7 I use the Microsoft WP7 Toolkit for transitions, and WP7 has to specify the in and out transitions on each view and animates the out tranisition, then the in transition, WPF has a containing control which can do the transition in a single animation.

Simply use TransitionNavigationFrame or a TransitionPartialView control instead to add transition support.

WPF Example

        <Transitions:SlideTransition Direction="Forward" />
        <Transitions:SlideTransition Direction="Back" />

WP7 Example

                <toolkit:TurnstileTransition Mode="BackwardIn" />
                <toolkit:TurnstileTransition Mode="ForwardIn" />
                <toolkit:TurnstileTransition Mode="BackwardOut" />
                <toolkit:TurnstileTransition Mode="ForwardOut" />

Foreground and Background Tasks

The Phoenix TransitionFrame supports both foreground and background operations. The only difference is that only a single foreground action can be done at once, and blocks the UI. The animations provided by the NavigationFrame's are also different. Happy to take pull requests on making the WPF animations nicer :)

Last edited Jan 2, 2012 at 5:49 AM by JakeGinnivan, version 1


No comments yet.