WPF and the Model-View-ViewModel Design Pattern

If you're a WPF developer and you're involved on developing enterprise level applications, I think that at least once a time you've thinked on what could be the best architecture for your application. Design Patterns are always the starting point to have in mind when architecturing a complex sofwtare system. But what's the best to choice?

I remember that, when writing Windows Form applications, my model of reference was the Model-View-Controller Design Pattern (MVC). But what about WPF?

The debats are always opened on this topic, but seems that the community of WPF developers agree on saying that the Design Patterns that fits well with WPF is what is called the Model-View-ViewModel Design Pattern:

 MVVM

In summary:

viewmodel

  • The View has the associated ViewModel set as its DataContext so that the View can easily data bind to ViewModel properties
  • The ViewModel reflects its changes to the Model by calling appropriate methods on the Model
  • The ViewModel exposes ICommand that the View data bind to, in order to execute actions
  • The Model signals its changes to the ViewModel by raising events

What I want to signal here is that on MSDN Magazine this month is appeared an interesting article about the MVVM Pattern written by Josh Smith. I highly recommend to read this article if you're a WPF developer. In my opinion this is one of the coolest real world sample on how to apply the Model-View-ViewModel pattern in order to architect a complex WPF application.

The time you'll spend on understanding the provided sample is gold... thanks Josh.

Technorati Tag: ,,

Print | posted on Thursday, January 29, 2009 4:34 PM

Comments on this post

# re: WPF and the Model-View-ViewModel Design Pattern

Requesting Gravatar...
# a bind to ViewModel properties
# The ViewModel reflects its changes to the Model by calling appropriate methods on the Model
# The ViewModel exposes IComma
Left by wholesale laptop adapter on May 23, 2010 2:30 PM

# re: WPF and the Model-View-ViewModel Design Pattern

Requesting Gravatar...
Thanks for this sir. I will put more time into this and hope to comprehend it better.
Left by web design chicago on Dec 03, 2010 8:03 AM

# re: WPF and the Model-View-ViewModel Design Pattern

Requesting Gravatar...
thats quite cool hey thanks old news and still revent is allways the way fowards thanks for that!
Left by Garagentor on Jun 08, 2011 11:56 AM

# re: WPF and the Model-View-ViewModel Design Pattern

Requesting Gravatar...
re: WPF and the Model-View-ViewModel Design Pattern
Left by ball valve on Feb 08, 2012 6:57 AM

Your comment:

 (will show your gravatar)
 
Please add 5 and 3 and type the answer here: