Learning WPF M-V-VM

For the last few months I’ve been studying M-V-VM and other WPF UI design patterns.

I have selected M-V-VM as my UI design pattern of choice for the soon to be released Ocean framework and code generation system.

I have read much of what Microsoft Partner Architect John Gossman, members of the WPF Disciples have published and specifically what my great friend and Microsoft & Code Project MVP Josh Smith has written on the UI design patterns.

Without any doubt, the best and clearest example of WPF M-V-VM I’ve seen is in Josh’s latest achievement, Crack.NETIf you want to learn M-V-VM from an expert, download Crack.NET source and study Josh’s masterpiece.


I’m sitting here at the Silicon Valley Code Camp having just taught a M-V-VM for WPF LOB session.   The applications I presented were all 100% testable.  The main application that has all the unit tests, can be run without ever displaying any UI.  It is amazing the power that M-V-VM delivers with such simplicity.  

I need to make a few videos and write up a blog post and I’ll share the code with you after next weekend.

I’m finishing up Ocean’s UI and it uses M-V-VM.

Below is a slide from the presentation.  It covers the layers found in an WPF LOB application.


Raleigh Code Camp

Next weekend, 15 Nov 2008, I’ll be in Raleigh, NC for the annual fall RDU Code Camp.  I’ll be launching Ocean at this code camp and will be doing several other sessions as well as being available in the Open Spaces.  See you there!!


Have a great day,

Just a grain of sand on the worlds beaches.

10 Responses to Learning WPF M-V-VM

  1. […] These posts will not include the “What”.  There are several good articles on the web that do that already.  Instead, I will be taking a deeper dive into MVVM and writing on the […]

  2. jezzza234 says:

    Great post!

    I’ve been doing research in to different patterns for planning an architectural overhaul of my companies application. We are currently using SOA with a Presentation -> Business -> Data Layer type flow whereby no layer has any direct reference to the other, its all abstracted out. This has worked great for us and there is several years of logic and great work coded in to these layers that we won’t change, however, our presentation layer has become a mess. We have been using WinForms and I’m keen for us to change and move on to the web using Silverlight for our presentation layer.

    It looks like (especially now with Silverlight 4) that MVVM is a great pattern for us to adopt and I’m keen to make sure we don’t ever messy our views anymore with complex code everywhere, so this will be good for us. There are a couple of things that confuse me about all the tutorials I’ve looked at on this though. Your diagram here is the most detailed I’ve seen and I like the way your business layer is separate to the VM as this seems to work with what we have in our business layer also. Would the following idea be sensible and a good idea?

    Silverlight .Net exposed by WCF over internet
    ( V -> VM -> M ) -> ( Business -> Data -> DAL -> Database )

  3. jezzza234 says:

    Didn’t show up well, but in my reply I’d meant that the first brackets were Silverlight, but the second brackets represented .Net exposed by WCF

    • Sure, Silveright communicating with a Data Service is very standard.

      Is you applicaiton public facing or Intranet?

      If Intranet, why not use ClickOnce then you could use WPF.

      Have a super day,


      • jezzza234 says:

        Thanks for your reply.

        My proposal is actually to have the Model talk to a Business Service, not a Data Service. The reason for this is as I say, we already have a LOT of business logic in our business layer and this is all written in full .Net. Does that sound like a reasonable thing to be doing? I actually like the idea of keeping the business logic abstracted out in this way anyway.

        As for ClickOnce and WPF, yes its public facing. I’ve actually considered it anyway as its not that different from what is done right now, but there are a lot of attractions to us going over the web instead.

    • Sounds good. Yes, Business Service is correct. This keeps most of your business logic on the server. In your case, the SL app is just acting as a UI over a service.




Get every new post delivered to your Inbox.

Join 255 other followers