Jake Ginnivan's blog

Windows Phone MVC - Released

I blogged a few weeks ago about the Windows Phone Essentials project, since then, I have started up the http://windowsphonefoundations.net/ website which is home to Windows Phone Essentials, Windows Phone MVC and Windows Phone MVP (and more projects in the future).


This will change over time, so check out the change log.

  • Strongly Typed Navigation
  • Custom Shell, Navigator and Journal to give better control over navigation of WP7
  • TransitionFrame comes out of the box, for nice navigation animations
  • Ability to pass arguments in navigation, rather than uri query strings
  • Modal Dialog support
  • Easy access to Obscured and Activated events on your view model
  • Full Testable! All major WP7 classes (WindowsPhoneFrame, WindowsPhoneApplication etc) all have Interfaces and are wrapped to allow you to test
  • Some helpers around Async. Execute.AsyncPattern or Execute.AsyncPatternWithResult synchronise async calls
  • Task/Chooser support, in a testable way
  • Convention based Controller and View discovery
  • Autofac Support Via an Extension
  • Easy access to page or application transient storage
  • Simple tombstoning support

Other cool stuff

Nice small/clean app.xaml/app.xaml.cs

<Application x:Class="HelloWindowsPhoneMVC.App"

        <WindowsPhoneMVC:NavigationApplication DefaultController="SomeController" DefaultAction="Blah" />

Type safe navigation

//Simple ICommand creation
ShowAboutDialogCommand = Controller<HomeController>().NavigationCommand(c => c.AboutDialog);
ShowAboutDialogCommand = Controller<HomeController>().NavigationCommand(c => c.AboutDialog, "A parameter");

//And normal navigation
Controller<HomeController>().NavigateTo(c => c.AboutDialog)

//And from xaml (not type safe)
<Button commands:Navigate.To="Home.About" Content="About" />

Easy lifecycle management

public SomeViewModel()
    Transient(() => Name); //Will be restored after tombstone

Also have the IObscuredAware and IActivationAware to easily get notified about view activation/deactivation and when your app is obscured.

Autofac support via extension

Simple add the NuGet package for Autofac support, then change in your App.xaml from <WindowsPhoneMvc:NavigationApplication /> to <AutofacIntegration:AutofacNavigationApplication />

The NuGet package will create you a Autofac module to do all your registrations of services.

Check it out

Head over to http://windowsphonefoundations.net/windowsphonemvc or download via NuGet at http://nuget.org/List/Packages/WindowsPhoneMVC

Feedback welcome! I think it makes WP7 development really enjoyable.

Project templates on their way.