share
Stack OverflowWhat framework for MVVM should I use?
[+190] [13] Rangel
[2009-09-11 07:53:18]
[ wpf mvvm frameworks ]
[ http://stackoverflow.com/questions/1409553/what-framework-for-mvvm-should-i-use ]

I am developing an application with the MVVM model, but I have reached a point where I need to choose which framework to use.

Among the possible options are:

In your experience, which is better?

(10) +1 - Good question, but please clarify 'better'. Different frameworks provide different advantages, the best depends on your requirements. Look forward to the answers :) - Russell
Well it would be very good that you can use with WPF and Silverlight, and with a minimal learning curve. - Rangel
(2) You might want to check out Caliburn too. codeplex.com/caliburn - Kent Boogaart
Sorry Kent. How could I forget Caliburn? - Pete OHanlon
Would it be fair to say that WPF Application Framework (WAF) is a lightweight version of the Composite Application Guidance (Prism) block? - Tarfa
Yes, I guess you could say that :) - Andrei Rînea
I see this is closed and old, but it doesn't have the framework I've been using lately github.com/reactiveui/ReactiveUI - kenny
[+164] [2009-09-11 08:38:34] Pete OHanlon [ACCEPTED]

It really depends on what you are trying to achieve, and how much infrastructure you want in place already, plus the ease with which you can find samples that help you out. I'm going to declare an interest here, because I've been actively involved in at least one MVVM framework, and I've had input into others through the WPF Disciples group, so I'm a little bit biased. Saying that, here goes:

Microsofts MVVM Toolkit [1] - this is still very much in the alpha stages. When it was originally released, it took a bit of a savaging from the Disciples because of what it didn't do. Saying that, MS is looking to beef this framework up so it's one to watch - it's just not ready yet.

MVVM Foundation [2] - ah Josh Smith's version of the framework. Josh is one of the daddies of MVVM, and has been a huge advocate and teacher of the pattern. As a result, a lot of what you'll find in other frameworks has Josh's fingerprints all over it. This framework is intended to provide the basics of MVVM, and not to address some of the more esoteric issues. Originally this was intended only for WPF, but people such as Laurent Bugnion and myself have added functionality/projects that mean this will be a Silverlight compatible framework as well.

WAF [3] - no experience of it, so I can't comment on it I'm afraid.

MVVM Light [4] - Laurent Bugnion's take on it, and just updated to version 2. This is a very good framework, but again it's not intended to cover every single aspect of MVVM applications. Given Laurent's background, it has very strong Silverlight and Blendability support in it.

Update Laurent has just informed me that the .NET 3.5 and .NET 4.0 versions are feature compatible. Wau to go Laurent.

Cinch [5] - Sacha Barber's excellent WPF only MVVM framework. This covers more ground than the frameworks I've talked about above. It's an excellent framework, and takes advantage of concepts covered in Bill Kempf's excellent Onyx [6] project. Onyx is intended to complement MVVM frameworks, and adds in functionality that's typically been hard for people to do in MVVM/WPF. Again, originally intended to be WPF only, Onyx has progressed to include SL compatibility - work I am particularly proud to have been involved in.

Prism [7] - Again, I've never used it, but I've heard a lot of good things about it.

Ocean [8] - Karl Shifflett, Program Manager on the Cider team, recently released a fully featured WPF MVVM framework. Again, this is an excellent framework and has lots to recommend it.

The bottom line is, download the different frameworks take a look at them and work out which one fits most intuitively with the way you think and with your requirements. If you think that you might want to support Silverlight from the same codebase then the WPF only frameworks should be discounted.

[1] http://www.codeplex.com/wpf/Release/ProjectReleases.aspx?ReleaseId=14962
[2] http://mvvmfoundation.codeplex.com/
[3] http://waf.codeplex.com/
[4] http://geekswithblogs.net/lbugnion/archive/2009/09/06/mvvm-light-toolkit-v1.1.1-whatrsquos-new.aspx
[5] http://sachabarber.net/?p=527
[6] http://wpfonyx.codeplex.com/
[7] http://www.codeplex.com/CompositeWPF
[8] http://karlshifflett.wordpress.com/mvvm/wpf-line-of-business-demo-application-source/

(4) +1, great answer. which one you are using in your daily work? - Jirapong
(4) I use one that we wrote, because we have very specialist needs for MVVM. It's heavily influenced by the work that Josh did, and I'll be releasing it as Open Source in the near future (I'm busy ripping out the proprietary bits). It's called Goldlight. - Pete OHanlon
(2) Thanks, great answer. - Rangel
Along with that, what is your data access layer framework? guys.. LINQ, LLBLGen, EF, nHibernate? - Jirapong
It depends on the project and requirements. Sometimes we use LINQ, sometimes NHibernate, sometimes Castle ActiveRecord, and sometimes eXpress Persistent Objects. - Pete OHanlon
(2) Hi Pete, just want to comment that the MVVM Light Toolkit works just the same for WPF 3.5 and WPF 4 as for Silverlight 3 and Silverlight 4. I am careful to keep the features in sync as much as I can. You are right about the blendability though, this is a major concern for me :) Cheers, Laurent - LBugnion
How is MVVM Light's blendability advantageous over the approach detailed in the ff. blog post: blogs.msdn.com/b/mcsuksoldev/archive/2010/08/27/…? - Chry Cheng
@Pete, An update to your answer would be great as the world must have moved on in the last few months - Ian Ringrose
(1) I've been disappointed that MVVM Toolkit hasn't been updated to work with Visual Studio 2010. Might want to add that to the decision making process. Most people I know using MVVM templates within 2010 are using MVVM Light and some migrated to that for this reason alone. - ScottCher
I'd love to read an update on the state-of-play in MVVM-framework-land, 21 months down the track. I wonder how much the techsperts have weeded, what's blooming, and what they're planting this season. - corlettk
+1 For explaining complicated things it in simple words :-) - Deepesh
Anything changed in the last almost-four years? (Except Josh Smith's defection :)) - Benjol
MVVM-Light is still going strong. - Heliac
1
[+44] [2011-07-06 12:51:13] Nasser Hadjloo

I found this article very useful http://www.japf.fr/2009/10/a-quick-tour-of-existing-mvvm-frameworks/ So that I bring it here for upcoming users

I update the Cinch section and add silverlight support to its features

I'm sorry for the long story

Common features:

• ViewModelBase class (for the implementation of the INotifyPropertyChanged interface)

• RelayCommand like class to link UI command to ViewModel’s handlers

• Unit tests comes with the framework

Cinch

• Author: Sacha Barber

• Silverlight support: no (Cinch version 2 supports Silverlight)

• Documentation: excellent, 6 articles published on CodeProject

• Hosting : CodePlex

• License: Code Project Open License

• Features:

  1. attached behaviors

  2. validation using IDataErrorInfo

  3. support for IEditableObject

  4. weak events creation and subscription

  5. mediator messaging using weak events

  6. IOC/DI support (using Unity)

  7. services: event logger, message box, open save dialog, popup

  8. threading helpers

  9. support for menu items

  10. closeable viewmodels

  11. MVVM code generator

MVVM Light Toolkit

• Author: Laurent Bugnion

• Silverlight support: yes

• Documentation: many articles available on Laurent’s blog + other developers as well

• Hosting: CodePlex

• License: MIT license

• Features:

  1. MSI installer

  2. VS project and item template

  3. VS code snippets

  4. Messenger system for inter-viewmodel communication

MVVM Helpers

• Author: Mark Smith

• Silverlight support: no

• Documentation: some articles on Mark’s blog

• Hosting: personal website

• License: not defined

• Features:

  1. attached behaviors

  2. viewmodel creation using markup extension

  3. attributes based validation

  4. IOC/DI using ServiceProvider approach

  5. closeable viewmodel

  6. wait cursor (using new WaitCursor() { // your code here })

MVVM Foundation

• Author: Josh Smith

• Silverlight support: no

• Documentation: articles about the Messenger implementation on Josh or Marlon Grech’s blog

• Hosting: CodePlex

• License: MS-PL

• Features:

  1. Messenger system for inter-viewmodel communication

  2. PropertyChanged event monitor

Caliburn

• Author: Rob Eisenberg

• Silverlight support: yes

• Documentation: complete online documentation available

• Hosting: CodePlex http://www.codeplex.com/caliburn

• License: MIT license

• Features:

  1. commands are built on top of Actions and thus share many of the same features, including multiple input parameters, filters and automatic asynchronous execution

  2. presenters that handles UI lifecycle issue such as handling activation, deactivation and shutdown semantics for various UI components

  3. Caliburn applications are fully testable

  4. various utilities such as a background task manager

  5. supports various UI pattern (not MVVM only)

  6. dependency injection container

Onyx

• Author: William e Kempf

• Silverlight support: no

• Documentation: basic introduction available on CodePlex

• Hosting: CodePlex

• License: not specified

• Features:

  1. ServiceLocator pattern

  2. ViewModel creation using a custom markup extension

  3. UI related services such as IDisplayMessage

Calcium

• Author: Daniel Vaughan

• Silverlight support: no

• Documentation: 2 very detailed articles on CodeProject (part1 and part2)

• Hosting: CodePlex

• License: use, copy, modify, and/or distribute and keep the copyright!

• Features:

  1. Module Manager for enabling or disabling of modules at runtime

  2. messaging services for interacting with the user from the client or server using the same API

  3. Command Service to associate WPF ICommands with content interfaces that only become active when an active view or viewmodel implements the interface

  4. Region Adapters for ToolBars and Menus

  5. Client-server logging ready to work out-of-the-box

  6. Includes modules, such as a Web Browser, Text Editor, Output Window, and many more

  7. Tabbed interface with dirty file indication (reusable across modules)

nRoute

• Author: Rishi

• Silverlight support: yes

• Documentation: many articles available on author’s blog (see CodePlex project home page for the links)

• Hosting: CodePlex

• License: MS-PL

• Features:

  1. support Blend3 behaviors and triggers models

  2. resource locator framework

  3. view services: OpenFileDialog, ShowMessage…

  4. uses attributes to map View and ViewModel together

Nito MVVM

• Author: Shammah

• Silverlight support: no

• Documentation: no

• Hosting: CodePlex

• License: not specified

• Features:

  1. various MVVM friendly implementations of the ICommand interface

Ocean

• Author: Karl Shifflet

• Silverlight support: no

• Documentation: articles available on Karl’s blog

• Hosting: personal website

• License: not specified

• Features:

  1. written in VB.Net

  2. attribute based validation

  3. viewmodel base classes: relaycommand, closeableviewmodel…

  4. SQL server data access layer

Basic MVVM framework

• Author: Lester Lobo

• Silverlight support: no

• Documentation: sample application available with the library

• Hosting: CodePlex

• License: MS-PL

• Features:

  1. delegating Commands\Keybinding

  2. messaging between VM’s

  3. handling events as commands with attached behaviors

  4. handling dialogs (and more) as services

  5. VS code snippets

GoodLight

• Author: Peter O’Hanlon •Silverlight support: yes

• Documentation: sample application available with the library

• Hosting: CodePlex

• License: MS-PL

• Features:

  1. “workspace” management (set of document that can be closed)

  2. skin support

  3. messaging between VM’s


Great post. Just thought I'd add that Cinch version 2 does suport Silverlight. - Kildareflare
2
[+40] [2009-10-02 16:14:46] jbe

I try to describe the Frameworks missing in Pete’s great answer:

MVVM Toolkit (Microsoft) [1] is a very lightweight library with Visual Studio project templates that should support beginners with this pattern. If Microsoft gets good feedback for their Toolkit then they might implement this as a new Visual Studio (maybe 2010) project template.

Prism (Microsoft p&p) [2] is a framework that provides more than the support for the MVVM pattern. The main goal of this project is to help you to build modular WPF and/or Silverlight applications. When you just need to implement the MVVM pattern or you are a beginner in .NET/WPF I won’t recommend this project. See also: Link [3].

WPF Application Framework (WAF) [4] is a lightweight framework that helps you to create WPF apps with MVVM. It’s just for WPF and so it doesn’t support Silverlight. It goes a bit another way than most other MVVM frameworks with the introduction of Controllers [5]. They are responsible for the application workflow and they mediate between various ViewModels.

[1] http://www.codeplex.com/wpf/Release/ProjectReleases.aspx?ReleaseId=14962
[2] http://www.codeplex.com/CompositeWPF
[3] http://msdn.microsoft.com/en-us/library/dd458863.aspx
[4] http://waf.codeplex.com
[5] http://waf.codeplex.com/Wiki/View.aspx?title=Model-View-ViewModel%20Pattern

3
[+14] [2009-09-11 12:00:28] rudigrobler

Also look at:

Caliburn [1] & Onyx [2]!

[1] http://caliburn.codeplex.com/
[2] http://wpfonyx.codeplex.com/

4
[+13] [2010-03-18 01:25:26] Pierreten

Meh. Mvvm doesn't really require an entire framework to support IMO. If you understand the concept, it's pretty straightforward to start off with a clean VM baseclass that implements INotify, and just go from there.


(2) Theres a reason why a lot of developer develop mvvm library. If what you say is true, then why would these developers waste their time? Why would these frameworks users keep using their favorite mvvm framework? True, "Mvvm doesn't really require an entire framework to support IMO". But its not practical to do without MVVM framework. - publicENEMY
-1 IMO writing your own RelayCommand class for ICommands, a Messenger class for inter-VM communication and your own IoC container to mention just the most basic tools required for a well functioning WPF application, is a major PITA. Your answer is only valid for the simplest of programs. - Heliac
5
[+8] [2010-10-21 22:04:28] Andrei Rînea

Mix your own!

I used EventAggregator from PRISM, with ViewModelBase from MVVM foundation and so on. I also tweaked the RelayCommand (DelegateCommand called in some places) to accept other data too, and so on.

I wouldn't recommend just one framework per se.


(17) I respectfully disagree, the problem with this approach will reveal itself when you get new joiners - the cost of entry on the project will be much higher as the in-house docs are generally not the priority. - Florian Doyon
(1) I can see the point about documentation.But there may not be a need to develop in-house docs.Links to the external sites with the documentation can be embedded in the code itself - Vasudevan Kannan
6
[+7] [2010-03-20 19:36:27] MCSean

my bet will be on Caliburn and MVVMlight, it seems that not many of these mvvm frameworks support silverlight. I can foresee that there will be more MVVM frameworks to choose from than the IoC frameworks, because it is harder to set up the feature boundary to the mvvm framework. I guess the best way to find out which one is better suit your project will be by listing/comparing their features.

Also check out Mix10. I learn a lot from the talk : building your mvvm framework.


(4) I found that talk quite useful. Here's a direct link: live.visitmix.com/MIX10/Sessions/EX15 - anshul
7
[+5] [2012-10-03 22:10:50] ramon22

Also Cocktail and DevForce framework by Ideablade [1]

[1] http://www.ideablade.com/

8
[+2] [2010-12-16 04:11:55] dave

I'm using Prism and like it. One of the big things for me was that there would be other people out there who could help me if needed and good examples. Once you get the basics running, there are a whole bunch of extensions you'll need for your app and it is just so much easier when you're working with the same framework as others.


9
[+1] [2010-08-05 15:16:16] mico

All in all, I am 90% through my application and all I have used of MVVM Toolkit is the factory function that builds a command for me given a delegate function to launch in Execute. I think I could switch to any other framework or no framework in a couple of hours.


10
[0] [2009-11-07 03:45:16] Scott Whitlock

If you're looking for Extensibility (the ability to write add-ins) on top of a WPF/MVVM application framework, then you may be interested in SoapBox Core [1] disclaimer: I wrote it. It's open sourced, so even if you don't use it, there might be some good ideas in there for you. It uses MEF for both Extensibility and IoC.

[1] http://soapboxcore.com/

11
[0] [2010-08-04 13:59:39] Daniel O

There's also nRoute [1]

A really nice application framework for WPF/Silverlight that supports MVVM

[1] http://nroute.codeplex.com

12
[0] [2011-02-16 21:59:03] John Rayner

Another one to consider is MEFedMVVM [1]. I've used it on a couple of projects and it's lightweight, non-intrusive and supports Silverlight and WPF. It's also able to support design-time data in Blend, for those who use that product.

[1] http://mefedmvvm.codeplex.com

13