MVVM or MVP for Winforms?

MVVM (Model-View-ViewModel) pattern  is more suited for WPF, while MVP (Model-View-Presenter) pattern  is more suited for Winforms. MVVM offers more benefits than MVP. It might still be possible to make Winforms support MVVM.  Hence I was trying to find whether it is beneficial to use MVVM over MVP in a winforms Application. I have summarized my findings below.

MVVM is more loosely coupled than MVP. In MVP, the View implements an interface IView and the presenter uses this interface. Since each view is different, it makes less sense to make each view implement the same IView interface. We might end up creating separate interfaces and Presenters for each view. With MVVM the view is aware of the viewModel, and the viewModel is aware of the model (but not vise versa). This means that multiple views can use a ViewModel and multiple ViewModels can use a Model. Hence MVVM is loosely coupled than MVP.



MVVM utilizes the features of WPF such as Data Binding, Commands, Data Templates. WPF (and Silverlight 2) features make MVVM a natural way to structure the application. This is not the case with Winforms.  Although Winforms supports databinding, you need to write some extra code to support two way data binding in Winforms by implementing INotifyPropertyChanged interface.  In the case of MVP, there is no need for two way data binding. The Presenter does the job of updating the view. You can also try creating a command manager for supporting Commands for MVVM, but it is much harder. Winforms do not support Data templates.  You can make Winforms support MVVM but you might not get all the benefits  of using MVVM in WPF.

If MVVM is properly used it is more testable than MVP.

The descision to use MVVM for Winforms is still up to you, based on your project needs.

Below are the few links I referred:

Niraj Bhatt on MVC vs. MVP vs. MVVM

Safe usage of INotifyPropertyChanged in MVVM scenarios

MVVM/Presentation Model With WinForms

MVVM for Winforms

MVC vs. MVP vs. MVVM


One Response to MVVM or MVP for Winforms?

  1. Tiago Freitas leal says:

    Nice post. You might like to know that at you will find some useful MVVM stuff fow Windows Forms:
    1) a databinding library with converters that can also bind an Action to a property change
    2) a command binding library that can bind an Action to any input event of any UI component

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: