Lester's WPF\SL Blog

Simple, Easy & Beautiful

CoreMVVM: A basic MVVM framework

CoreMVVM: A basic MVVM framework

Rate This
  • Comments 1

 CoreMVVM download (for those in a hurry :) )

The MVVM Toolkit is a pretty barebones template for MVVM and is a good place to start with if you are new to this pattern. Over time, as i played around with this toolkit, the library grew in size. Its been useful for me - so i thought i might as well share it out :) .. The code is an extension of the Toolkit and pulls in a lot of concepts from other fameworks out in the wild... Will have a subsequent post on these frameworks. So getting back to this library, it includes support for:

  • Delegating Commands\Keybinding
  • Messaging between VM's
  • Handling events as commands with attached behaviors
  • Handling dialogs (and more) as services

A very simple sample is also included to show the various parts in action. (Nothing fancy)

To make the writing of commands with Attached behaviors I have included Damian's code snippet, which you place under Documents\Visual Studio 2008(10)\Code Snippets\Visual C#\My Code Snippets. The shortcut for its usage in code is cmdbehavior

 You could as well just run the installer. If you do use the installer edit the snippet to include CommandParameter = e; at the beginning of the last function (On$EventType$)

You would need to fill 4 parts in the snippet:

  • CommandAction - Descriptive name of what the command performs
  • BehaviorName - Attached behavior name (this hooks the event)
  • ControlType - Type of control to which the command will attach
  • EventName - Name of the control event that the behavior hooks up

Hopefully you'll find the library useful. Also, this library by no means covers all possible scenarios. Have fun coding.

As mentioned earlier the library uses code\concepts from the following frameworks

Cinch - for the Services and ViewModelBase
Messaging - from Marlons\Josh's mediator posts
Prism - for the commanding model

 

CoreMVVM Download Link for the library\demo

Share this post

 

  • Haven´t tried it, but The effort seems good. I like the simplicity of the MVVM Toolkit Template, but it certainly lacks a few things. On the other hand I think that going all the way to use Prism or Caliburn is abit over the top in many cases. By the looks of it, this this library fits in somewhere in between them, which happens to by right up my alley! Will definitely have a look at it!

Page 1 of 1 (1 items)