This project is read-only.


Install the Project Template from the Visual Studio Gallery

Install the Libraries from Nuget
Add it to your project with nuget: Install-Package WindowsPhoneMvp

Project Description

WindowsPhoneMvp is an MVP implementation for Windows Phone, the MVP pattern works well on Windows Phone because of its testability and flexibility. Use WindowsPhoneMvp to take back control of development and focus on creating great apps.

When developing projects for WindowsPhone7 you may have noticed that without the proper binding support found in WPF, ViewModels quickly become a dumping ground, growing to an unmanageable size and doing more then they should, so take a step back, rediscover MVP.

This project is based on the implementation of the MVP pattern from webformsmvp, but written to fully integrate with WindowsPhone.


Visit the documentation section.
And also the online api documentation. (IE Only)

Some of the benefits:

Keep Beloved Designer Support

designer support.png

Easy wireup

Inside the App.xaml.cs file, we simply hook into some of the phone navigation and activation events.

private void InitializePhoneApplication()
    if (phoneApplicationInitialized)

    // Create the frame but don't set it as RootVisual yet; this allows the splash
    // screen to remain active until the application is ready to render.
    RootFrame = new PhoneApplicationFrame();
    RootFrame.Navigated += CompleteInitializePhoneApplication;

    // Handle navigation failures
    RootFrame.NavigationFailed += RootFrame_NavigationFailed;

    _container = Bootstrap();

    var navigationHook = _container.Resolve<INavigationServiceContext>();
    PresenterBinder.Factory = new AutofacPresenterFactory(_container);

    // Ensure we don't initialize again
    phoneApplicationInitialized = true;

Simple binding of presenters to your views


Easy persistence of transient properties

public MainPresenter(IMainView view)
    : base(view)
    //Transient properties anywhere
    Transient(() => this).Property(x => x.PersistMe);
    //Easy built in support to give properties on the viewmodel transient state
    Transient(x => x.PersistMeToo);

Access a Navigation service from your Presenters

Navigate to the strongly typed views, or view interfaces.

Easily setup an ICommand property for navigation.
Model.NavigatingToViewTwo = Navigate.ByCommand<ISecondView>();

Pass parameters with style:
Navigate.ToView<IGpsView>(x => x.With("Activity", Model.SelectedActivity.Name)
    .With("Parameter2", hasParameter.ToString()));

Simple access to parameters that have been passed to your view
  • Via Params[] collection
  • Via OnNavigatedTo() method
public class GpsRecorderPresenter : Presenter<IGpsRecorderView, GpsRecorderViewModel>
    public GpsRecorderPresenter(IGpsRecorderView view) : base(view)
        View.Load += View_Load;

    void View_Load(object sender, EventArgs e)
        var activity = Params["Activity"];
        //Code that does things with activity

    public override void OnNavigationTo(NavigationData navigationData)
        //Do navigated things

Download the code, take a look for yourself and see if it works for you.

Last edited May 14, 2011 at 12:49 PM by brendan, version 12