Stack OverflowWhat applications could I study to understand (Data)Model-View-ViewModel?
[+52] [11] bitbonk
[2008-11-08 19:47:13]
[ .net wpf design-patterns mvvm ]

I understand the basics of the Model-View-ViewModel pattern or as Dan Crevier calls it the DataModel-View-ViewModel [1] pattern and I understand that it is a good approach to design WPF based applications. But there are still some open question. For example: Where do I put my business logic where my validation logic? How do I decouple the Database (in a way that the underlying storage solution can easily be exchanged) from the Model but still be able to do complex data mining? How do I design the ViewModel that it can observe state changes in the Model?

Do you know of any applications that use this pattern that I could study for evaluate different approaches? Preferably ones where the source code is available?

Or maybe you even know of articles, books, blogs, websites that go a bit more into detail?

[+36] [2008-11-08 23:16:10] cplotts [ACCEPTED]

I am still exploring these patterns myself, but I would point you to the Stock Trader reference implementation inside of Prism [1] (aka the Composite Application Guidance for WPF).

Prism calls the pattern 'Presentation Model'. You can find more info about Prism from Glenn Block's blog [2] and Brian Noyes' blog [3]. Here also, is the MSDN link to the Presentation Model in Prism [4].

I know that Blend also uses the M-V-VM pattern extensively. It is too bad that the Blend source code isn't open to all.

Finally, don't miss this blog post [5] which points to a video done by Jason Dolinger on M-V-VM. It's excellent and highly recommended. My blog [6] also has sample code to follow along the video with.


I just wanted to add to this post all the links/posts that I have discovered on this topic:

  1. Dan Crevier's series [7] on Data Model-View-View Model
  2. John Gossman's series on Model-View-View Model: 1 [8], 2 [9], 3 [10], 4 [11], 5 [12], 6 [13]
  3. Julian Dominguez (from the Prism team) has three posts of interest: 1 [14], 2 [15], 3 [16]
    In the third post, he has a little sample application that shows off Presentation Model with DataTemplate(s).

Update #2

Josh Smith just published an excellent article [17] on M-V-VM for MSDN Magazine. It comes with some sample code too!


The presentation Model of PRISM is in reality a passive view (the presenter knows an interface that represents the view) and a presentation model of Martin Fowler (All the data of the view are stored inside the presenter, and synchronized with the view). MVVM is only the presentation model of MF. - Nicolas Dorier
(3) Jason Dollinger's video is excellent. Highly recommended. - Gus Paul
The Jason Dollinger video is the best place to get started, it's excellent. - Cole Shelton
[+16] [2008-12-05 20:50:18] viggity

Jason Dolinger has a great (long) screencast of MVVM

(4) That screencast is a great intro to MVVM - Wilka
[+4] [2008-12-05 20:55:25] Pete OHanlon

Josh Smith has put together one of the best implementations of M-V-VM in his Crack.NET [1] project. All of Josh's projects are good, but this one is outstanding.


[+3] [2009-02-11 22:22:43] andyp

I'm researching MVVM myself right now, so I have a few additional references to offer. Jeremy Alles [1] recently published a "Very Simple M-V-VM Demo Application" [2], then there's Josh Smith [3]'s WPF apps with the Model-View-ViewModel design pattern [4] in MSDN Magazine and Karl Shifflet [5]'s Channel 9 show about MVVM [6]. And last but not least Jaime Rodriguez [7]' just released his very nice M-V-VM training day sample application "Southridge Realty" [8].


[+2] [2008-11-09 06:02:31] Jobi Joy

See this very informative post from Karl -

[+2] [2008-11-09 08:24:37] bitbonk

Here are some more resources by Josh Smith [1]:


[0] [2008-12-04 09:35:13] bitbonk

Another very interesting read: A discussion from the WPF disciples group: Thought: MVVM eliminates 99% of the need for ValueConverters [1]


[0] [2008-12-30 13:18:11] Michael L Perry

I just blogged about this in Presentation Model Without INotifyPropertyChanged [1]. This is a technique that you can use to implement the M/V/VM pattern without writing any bookkeeping code. You don't need to implement INotifyPropertyChanged. You can bind directly to plain-old .NET code in your View Model, and it will update when your Data Model changes.


[0] [2009-02-27 09:43:10] Przemek

I would like to share with you some recent web activities that may shed some new light on the question:


[0] [2009-04-30 15:24:15] Gus Paul

Mark Smith has a great helper library for MVVM/WPF usage here [1]


[0] [2011-02-20 19:07:55] jbe

You might be interested in the WPF Application Framework (WAF) [1] project. It provides extensive sample applications which are using the MVVM pattern and some documentation about the Pattern itself.