Install the Project Template from the Visual Studio Gallery
Install the Libraries from Nuget
Add it to your project with nuget: Install-Package WindowsPhoneMvp
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
This project is based on the implementation of the MVP pattern from
, but written to fully integrate with WindowsPhone.
And also the online api documentation.
Some of the benefits:
Keep Beloved Designer Support
Inside the App.xaml.cs file, we simply hook into some of the phone navigation and activation events.
private void InitializePhoneApplication()
// 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)
//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)
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.