how do i do… With the Model-View-ViewModel pattern

While building the Composite Application Guidance for WPF and Silverlight (AKA Prism V2), we relied heavily on the Model View ViewModel pattern. But while this pattern is definitely the best thing ever, it took me a while to come to grips with it:

First of all, I have a mostly Windows Forms and ASP.Net background. With these technologies, I typically applied different separated presentation patterns, such as Model View Presenter. So when I tried to build WPF and Silverlight applications, I tried to apply the same techniques. But what I found was, that building WPF and Silverlight applications is significantly different from those other technologies. When I tried to apply the Model View ViewModel pattern, I kept running into questions. How do I do “X” in this pattern.

At first glance, the Model View ViewModel does not differ that much from other separated patterns such as Model View Presenter. It certainly tries to achieve similar goals, but it does it in subtly different ways.

In this series of blog posts, I’m going to describe how to apply the Model View ViewModel pattern and what kind of challenges you’ll have to overcome and what kind of decisions you’ll have to make. Over the next couple of weeks, I’m going to be writing about these topics:

How do I:

(Inside the MVVM pattern)

(When applying the MVVM pattern to an application)

  • Instantiate my Views / ViewModels
  • Create a logical ViewModel structure of my application
  • Implement automatic datatemplate selection in Silverlight

Hope you’ll find these topics interesting. If there are specific things you are struggling with, let me know. If i have time, I’ll try to write something about that as well.

<Download demo app>

Note, you’ll need to download the following references:

As I’m publishing new blog posts, I’ll keep updating this app, so check back sometimes for updated versions..

Comments (4)

  1. Erchan says:

    Hi Erwin

    All topics are interesting, it will be the usefull reading.

    Is there any way to apply MVVM with MEF?

    Thanks. Sorry for english.

  2. Joepro says:

    This is a great idea for a blog series.  I, myself, come from a winforms background (mostly MVP) and am struggling with MVVM.

    Looking forward to the posts!

  3. erwinvandervalk says:

    Good point! MVVM with MEF.. I’ll try to address that when I discuss instantiating views/viewmodels. Keep posted 😉



  4. dawid.lazinski says:


    Great series. I am especially looking forward to the "Work with asynchronous methods" section.

    If you havn’t created it yet, you may want to partly focus on the case of asynchronous progress windows and state notification. Altough I have a quite good idea of threads and dispatchers I often face the issue of delegating method calls on to the right thread.

    From the greater perspetive please state your opinion on which parts of the MVC model should be "asynchronous aware".

    Should the data be retrieved sync/async by the model?

    Should the presenter invoke the command bodies sync/async?

    I’d be very greateful if you reffer to those matters a little bit.

    Once again, very useful posts, regards.

Skip to main content