Install the Project Template from the Visual Studio Galleryhttp://visualstudiogallery.msdn.microsoft.com/5da795d1-30eb-4f46-9bd0-7442d505720dInstall the Libraries from Nuget
Add it to your project with nuget: Install-Package WindowsPhoneMvphttp://nuget.org/List/Packages/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 MVP.
This project is based on the implementation of the MVP pattern from webformsmvp
, but written to fully integrate with WindowsPhone.
Visit the documentation
And also the online api documentation.
Some of the benefits:
Keep Beloved Designer SupportEasy wireup
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 viewsEasy 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.