Code generator for MVVMLight (VB and C#)

Apr 24, 2010 at 9:13 AM
Edited Jul 11, 2010 at 9:52 PM

I've just finished a code generator (VB and C#) utiizing T4 templates and the awesome T4Toolbox for generating view models and views for MVVMLight @LBugnion

Download here: http://bit.ly/9I7Ex3

It will generate views, viewmodels, and the "snippet" needed for the ViewModelLocator in the VB.NET and C# languages.

Generation can be a UserControl, Window, or a Page.

I've included a sample app too, showing the following patterns/methods:

  • Using NavigationMessage to enable/disable items, for navigation, and to close the main window.
  • Using MEF to get our list of pages in the sample app.

Enjoy!

Rick

Coordinator
Apr 25, 2010 at 11:08 AM

Interesting, thanks for sharing!

Laurent

Apr 30, 2010 at 11:31 PM

I've updated the download above. Here's the changes:

  • Added C# generation
  • Cut the templates I used in half!
  • Converted the events to use the messenger class, for navigation and window closing.

Enjoy!

Rick

 

May 25, 2010 at 11:21 PM

The templates were upgraded again, with bug fixes. The link in the top post is the download.

Jul 9, 2010 at 12:02 PM

How does one "install" these, maybe incldue a readme.txt :)

 

Thanks

 

Jul 11, 2010 at 7:36 PM
Edited Jul 11, 2010 at 9:51 PM

In your project, create a "CodeTemplates" folder and stick the "MVVMGen" folder in there. Then open the MVVMScript.tt file, edit it and click save. Watch the magic happen!

UPDATE: I have updated the link above. It includes a sample app with usage.