Showing posts with label MVVM. Show all posts
Showing posts with label MVVM. Show all posts

Thursday, October 09, 2014

MVVM Light V5 for Windows, Xamarin and * (pretty much everywhere you'd want to .NET MVVM)

Laurent Bugnion (GalaSoft) - Announcing MVVM Light V5 for Windows and Xamarin

Here at the Xamarin Evolve conference in Atlanta, I just announced the immediate availability of MVVM Light V5. This version runs on the following platforms:

  • Windows Presentation Foundation (3.5, 4, 4.5, 4.5.1)
  • Silverlight (4 and 5)
  • Windows Phone (7.1, 8, 8.1 Silverlight, 8.1 RT)
  • Windows Store (8, 8.1)
  • Xamarin Android
  • Xamarin iOS
  • Xamarin Forms

What’s new?

There are three major changes in this version: Xamarin Support, NavigationService and DialogService, and Portable Class Library support.


Visual Studio Gallery - MVVM Light (VS2013)


The MVVM Light Toolkit is a set of components helping people to get started in the Model - View - ViewModel pattern in Windows 8, Silverlight, WPF, Windows Phone, Xamarin Android and Xamarin iOS. It is a light and pragmatic framework that contains only the essential components needed. It includes classes such as RelayCommand, Messenger, ViewModelBase and ObservableObject, SimpleIoc and more.

MVVM Light Toolkit (

Jump to: Intro / Documentation / Installation and Creation / Source and Codeplex / Support / Donate / Credits / Praises



The main purpose of the toolkit is to accelerate the creation and development of MVVM applications in WPF, Silverlight, Windows Store (RT) and for Windows Phone.

The MVVM Light Toolkit helps you to separate your View from your Model which creates applications that are cleaner and easier to maintain and extend. It also creates testable applications and allows you to have a much thinner user interface layer (which is more difficult to test automatically).

This toolkit puts a special emphasis on the "blendability" of the created application (i.e. the ability to open and edit the user interface into Blend), including the creation of design-time data to enable the Blend users to "see something" when they work with data controls.


My current workday MVVM framework of choice is Caliburn.Micro, but I keep seeing more and more projects using MVVM Light, to the point where I think I'm going to have to check it out... That and it's hard to beat how portable it is. :)

Wednesday, June 11, 2014


DevExpress - Free DevExpress MVVM Framework released

Previously, I mentioned our plans to offer a free version of the MVVM Framework. I am happy to announce the free DevExpress MVVM Framework is now available on NuGet and GitHub.


The free DevExpress MVVM Framework includes all the capabilities of the MVVM libraries installed with our components, except for those features specific to component integration. If you are using an up-to-date component installation, you already have full access to the MVVM Framework. Now, anyone can build an app with the DevExpress MVVM Framework or introduce our MVVM to an existing project – even when that project makes use of another framework.

The major benefits of the DevExpress MVVM Framework are the independent parts in the framework, used separately or with other third-party MVVM libraries.

  • With POCO, get clear ViewModel code without unnecessary duplications. The POCO mechanism automatically generates bindable properties, commands, asynchronous commands, wrapper code for services, and much more.
  • EventToCommand support now includes converting event arguments, calling bound commands via Dispatcher, and processing attached events.
  • Finer visual customizations are available from the ViewModel using a set of predefined Services or custom Service.
  • Messenger takes the difficulty out of building loosely coupled app architectures.
  • Modify the behavior of any visual component. Simply create a Behavior and assign it with an Interaction.
  • Choose from a new set of converters useful for everyday scenarios.

Easily find the free MVVM Framework on NuGet by searching “dx mvvm”. The free DevExpress MVVM Framework is distributed under the MIT License. Source code, testing libraries, and samples are available on GitHub. [GD: Post Leached In Full]



DevExpress MVVM Framework is a set of components helping to work in the Model-View-ViewModel pattern in Silverlight and WPF.


There are two versions of the DevExpress MVVM Framework:

1. The version that is included to the DevExpress WPF/Silverlight component suite.

2. The free version that is very similar to the first one. The only difference is that it does not contain some capabilities that are only needed when the framework is used with DevExpress components.

Although DevExpress provides documentation for the first version only, you can use this documentation even if you use the free version. The documentation is available by the following link:

At the DevExpress site, you can find several training blog posts:


The Free DevExpress MVVM Framework is available from NugGet:

While I'm not sure we really need another MVVM framework, I do applaud DevExpress in releasing this and releasing it as open source. That and I'm glad to see a little WPF love. :)

Wednesday, April 30, 2014

Prism 5.0 for WPF eBook (epub, mobi, pdf)

Microsoft Downloads - Prism 5.0 for WPF - Book Download


Date Published: 4/29/2014



Prism provides guidance designed to help you more easily design and build rich, flexible, and easy to maintain Windows Presentation Foundation (WPF) desktop applications. Using design patterns that embody important architectural design principles, such as separation of concerns and loose coupling, Prism helps you to design and build applications using loosely coupled components that can evolve independently but which can be easily and seamlessly integrated into the overall application. Such applications are often referred to as composite applications.


This lets you take the online doc's offline and read them in your reader of choice...


Related Past Post XRef:
Prism continues its Windows Desktop/WPF/MVVM Love with v5

Monday, April 21, 2014

Prism continues its Windows Desktop/WPF/MVVM Love with v5

Francis K. Cheung - Prism 5.0 for WPF just shipped.

Prism version 5.0 for WPF is now available. This version of Prism includes updates to existing and several new NuGet packages:

  1. Prism
  2. Prism.Composition (New)
  3. Prism.Interactivity (New)
  4. Prism.Mvvm (New)
  5. Prism.MefExtensions
  6. Prism.UnityExtensions

We’ve updated Prism 4.1 with bug fixes and a few new features. ...

Developer's Guide to Microsoft Prism Library 5.0 for WPF

April 2014

Prism provides guidance in the form of samples and documentation that help you easily design and build rich, flexible, and easily maintained Windows Presentation Foundation (WPF) desktop applications. Using design patterns that embody important architectural design principles, such as separation of concerns and loose coupling, Prism helps you to design and build applications using loosely coupled components that can evolve independently but which can be easily and seamlessly integrated into the overall application. In short, these applications are "built to last" and "built for change." These types of applications are known as composite applications.

This topic provides a brief overview of the Prism concepts with links to associated source code and documentation. If you are considering upgrading from Prism 4.1 to Prism 5.0 we include a "What’s New" and "Upgrading from Prism 4.1" topic that you should read.




What's New in Prism Library 5.0 for WPF

Prism 5.0 includes guidance in several new areas, resulting in new code in the Prism Library for WPF, new and updated QuickStarts, and updated documentation. Parts of the Prism Library changed between Prism 4.1 and Prism 5.0 to support the new guidance, fix existing issues, and respond to community requests.


New Guidance

Prism 5.0 contains several areas of new guidance as follows:

  • Prism.Mvvm is a portable class library that encapsulates Prism’s MVVM support. This library includes ViewModelLocationProvider. Views and view models can be wired up together using the new ViewModelLocationProvider’s convention-based approach as explained in Implementing the MVVM Pattern. View model construction can be accomplished using a dependency injection container. The ViewModel Locator’s extensibility points are discussed in Extending the Prism Library. DelegateCommands are now extendable and provide Async support. A new implementation of the INotifyPropertyChanged interface, the BindabaleBase class, was added.
  • The PopupWindowAction class was added to the Prism.Interactivity assembly to open a custom window in response to an interaction request being raised.
    The InvokeCommandAction action provided by Prism now passes trigger parameters to the associated command.
    For more information see Advanced MVVM Scenarios.
  • The EventAggregator classes have been moved to the Prism.PubSubEvents portable class library.
  • The NavigationParameters class can now be used to pass object parameters during navigation, using the overloads of the RequestNavigate method of a Region or RegionManager instance.

Changes in the Prism Library

Prism Library 5.0 includes changes related to new functionality, code organization, and APIs.

Code Organization


API Changes


Additions to the Prism Library Core API

The following namespaces were added to the Prism Library to support the new areas of guidance added in Prism 5.0:

  • Microsoft.Practices.Prism.PubSubEvents was added to help you send loosely coupled message using a portable class library.
  • Microsoft.Practices.Prism.Mvvm was added to assist you in implementing MVVM using a portable class library and several platform specific libraries.
  • Microsoft.Practices.Prism.SharedInterfaces has been added to share the IActiveAware interface between Prism and Prism.Mvvm assemblies, therefore the IActiveAware interface has been moved to this assembly. It is also intended for future use.

CodePlex Issues Resolved

  • ...

Example Code Changes

Prism 5.0 contains eleven separate code samples that demonstrate portions of the provided guidance. Several samples from Prism 4.1 were removed or replaced, and new samples added.

The following samples were added for Prism 5.0:

  • Basic MVVM QuickStart. This QuickStart shows a very simple MVVM application that uses the ViewModel Locator and show a parent and child ViewModels. For more information, see the MVVM QuickStart.
  • MVVM QuickStart. This QuickStart was removed for this version.
  • MVVM Reference Implementation. This reference implementation was removed for this version.
  • View-Switching Navigation QuickStart. This QuickStart now supports WPF. It demonstrates how to use the Prism region navigation API. For more information, see View-Switching Navigation QuickStart.
  • State-Based Navigation QuickStart. This QuickStart now supports WPF. It shows an approach that uses the Visual State Manager to define the views (states) and the allowed transitions. For more information, see State-Based Navigation QuickStart.
  • UI Composition QuickStart. This QuickStart now supports WPF. It replaced the View Injection QuickStart and the View Discovery QuickStart from Prism 2.0. In the current versions, both concepts are shown in one example application. For more information, see UI Composition QuickStart.
  • Interactivity QuickStart. This new QuickStart demonstrates how to exposes an interaction request to the view through the view model. The interactions can be a popup, confirmation, custom popup, and a more complex case where the popup needs a custom view model. It also shows Prism’s InvokeCommandAction action that passes the EventArgs from the trigger, as a command parameter. For more infromation, see Interactivity QuickStart.

NuGet Packages Now Available

In your application, you can now use NuGet to add references to the Prism assemblies. These packages include:


Microsoft Downloads - Prism 5.0 for WPF – April 2014

Prism provides guidance designed to help you more easily design and build rich, flexible, and easy to maintain Windows Presentation Foundation (WPF) desktop applications.


MSDN Code Gallery - Getting Started Code Sample Using the Prism Library 5.0 for WPF

In this lab and associated sample, you will learn the basic concepts of modular application development using the Prism Library, and apply them to create a solution that you can use as the starting point for building a composite Windows Presentation Foundation (WPF) application. After completing this lab, you will be able to do the following:

  • You will create a new solution based on the Prism Library.
  • You will create and load a module.
  • You will create a view and show it in the shell window. 

This lab includes the following tasks:


MSDN Code Gallery - MVVM Code Sample using the Prism Library 5.0 for WPF

The Model-View-ViewModel (MVVM) QuickStart provides sample code that demonstrates how to separate the state and logic that support a view into a separate class named ViewModel using the Prism Library. The view model sits on top of the application data model to provide the state or data needed to support the view, insulating the view from needing to know about the full complexity of the application. The view model also encapsulates the interaction logic for the view that does not directly depend on the view elements themselves. This QuickStart provides a tutorial on implementing the MVVM pattern.

A common approach to designing the views and view models in an MVVM application is the first sketch out or storyboard for what a view looks like on the screen. Then you analyze that screen to identify what properties the view model needs to expose to support the view, without worrying about how that data will get into the view model. After you define what the view model needs to expose to the view and implement that, you can then dive into how to get the data into the view model. Often, this involves the view model calling to a service to retrieve the data, and sometimes data can be pushed into a view model from some other code such as an application controller.

This QuickStart leads you through the following steps:

  • Analyzing the view to decide what state is needed from a view model to support it
  • Defining the view model class with the minimum implementation to support the view
  • Defining the bindings in the view that point to view model properties
  • Attaching the view to the view model



That should be enough Prism for WPF to get you started at least...

Monday, May 13, 2013

Okay, Okra! Windows Store Templates that make MVVM apps, and pages, easier and quicker

Andy On WPF, Windows 8 and Beyond - Windows Store MVVM Templates for Visual Studio

If you have ever tried to create a Windows Store application using the MVVM pattern then you will probably have found that the Visual Studio project and item templates are a bit cumbersome. I often find myself adding a new page to my projects using one of the default templates, only to need to rewrite it to follow the MVVM pattern before I can even start adding application specific logic. What if there was a way to take advantage of the selection of project and page templates provided by Visual Studio, but have them produce fully MVVM compliant code?

Well today I’d like to announce the release of a free extension for Visual Studio 2012 (including the Express editions for Windows 8) that provides just that. It is based upon the open source Okra App Framework, and provides almost all of the Visual Studio Windows Store templates in an MVVM friendly manner.


What Templates are Provided?

There are two types of template included, project templates and item templates. The project templates are designed to get you started with a new application and provide exactly the same behaviour as the default Visual Studio templates (but written following the MVVM pattern).

  • Okra Basic App - A single-page Okra App Framework project with no predefined controls or layout.
  • Okra Grid App - A three-page Okra App Framework project that navigates among grouped items arranged in a grid. Dedicated pages display group and item details.
  • Okra Split App - A two-page Okra App Framework project that navigates among grouped items. The first page allows group selection while the second displays an item list alongside details for the selected item.


Also included are a number of item templates that allow you to add new pages to any existing Okra App Framework based application, whether created using the project templates or not.

  • Basic Page (MVVM)
  • Split Page (MVVM)
  • Items Page (MVVM)
  • Item Detail Page (MVVM)
  • Grouped Items Page (MVVM)
  • Group Detail Page (MVVM)
  • Search Contract (MVVM)
  • Share Target Contract (MVVM)
  • Settings Pane (MVVM)




As I have discussed the new “Windows Store MVVM Templates for the Okra App Framework” make it quick and easy to implement pages following the MVVM pattern for use in Windows Store applications. The behaviour of all the templates has been designed to be identical to the default Visual Studio templates, with the added benefit of clean separation of code, unit testability and design-time data

Thanks for the heads up on this Andy (and nice work!). I think you're right, that my readers might find this useful. And heck, if they don't I DO! :)


Related Past Post XRef:
The first step in gestating a Metro app... Cocoon

Tuesday, April 23, 2013

The First [12] Steps in using Caliburn Micro to build awesome Windows Phone 8 App's - First steps with Caliburn Micro in Windows Phone 8 – The complete series

This post is simply a collector of all the blog posts I wrote about using Caliburn Micro, a very powerfull Model-View-ViewModel framework, in Windows Phone 8. The posts are listed in chronological order, so it will be easier for you to follow the logic path of the posts: from the basic concepts (what’s Caliburn, conventions, etc.) to the most complex stuff (tombstoning, collections, messaging).

This list will be published also at the bottom of every post of the series, so that it will be easier for you to jump from a post to another.



Caliburn Micro is one of my favorite MVVM frameworks and I'm really starting to fall in love with my Windows Phone 8, so highlighting this just seems natural, doesn't it? :)


Related Past Post XRef:
Caliburn.Micro v1.5.0 released (CM gets Tasks, Async/Await and Share/Setting for RT... and bug fixes of course)
Callisto + Caliburn.Micro + these Dialog Helpers = Happy Windows RT Dev Camper
Caliburn.Micro RTW’s (Think a”Lighter/smaller/micro MVVM Framework for WPF, WP7 & Silverlight)
Doing WPF/SilverLight? Interested in presentation patterns like MVVM, MVC? Testing/TDD friendly development? Solutions to common UI architecture problems? Then Caliburn might just be for you

Tuesday, March 19, 2013

Caliburn.Micro v1.5.0 released (CM gets Tasks, Async/Await and Share/Setting for RT... and bug fixes of course)

Caliburn.Micro - Caliburn.Micro v1.5.0

"Release Notes

This release fixes many bugs. It also adds support for Task and async/await functionality, including integration with co-routines. For WinRT, we now have built-in support for the Share and Settings charms.

Packages Available on Nuget

  • Caliburn.Micro – The full framework compiled into an assembly.
  • Caliburn.Micro.Start - Includes Caliburn.Micro plus a starting bootstrapper, view model and view.
  • Caliburn.Micro.Container – The Caliburn.Micro inversion of control container (IoC); source code drop-in.
  • Caliburn.Micro.EventAggregator – The Caliburn.Micro event aggregator; source drop-in.
  • Caliburn.Micro.INPC – The Caliburn.Micro INPC infrastructure: PropertyChangedBase, BindableCollection, Execute.OnUIThread and InDesignMode checking; source drop-in.


Caliburn.Micro is one of my MVVM Frameworks of choice, so a new release is good news for me... In some cases CM is just magic and makes MVVM pretty darn easy and seamless.

Monday, February 25, 2013

Windows 8 + Kona + Steve = Itinerary Hunter

#WINNING with C# - Windows Store App Example: Itinerary Hunter


Using KONA as a framework, you can think of KONA as the Windows 8 equivalent of PRISM, I have created a Windows Store App for Itinerary Hunter.

The solution features distinct projects for UI views, UI logic (view models, converters, etc), services and tests.  Interfaces are used throughout to enable mocking for unit tests.

Here’s some screenshots of the app



stevenh77 / ItineraryHunter-Win8


I've not seen to many examples yet of Kona based apps, so when I saw this I wanted to make sure to highlight it...


Related Past Post XRef:
Kona, Kona, Kona! [Think P&P dev guidance for composite application WinStore Apps {Yes, like Prism, but not}]

Thursday, February 07, 2013

Intro to MVVM in four easy episodes....

CodeProject - MVVM # Episode 1 (2, 3 & 4)


MVVM seems, to me, to be the best way to develop applications that are both flexible - allowing changes to the GUI without complex rewrites, and allowing testing of the client logic without needing to resort to complex macros.

In this series of articles, I will present a small application in WPF, using an enhanced MVV pattern that I'm calling MVVM#.

So, what's different about my implementation? The main things are:

  • Message Tracking: When a message is sent, we now know if it has been handled.
  • Cancellable messages: A ViewModel can stop the message being sent further down the chain.
  • Easy Peasy Modal Dialog windows
  • No 'Main window': Everything is a View.
  • Use of a Controller: The Controller controls the application.
  • Easy to use Design Time Data for 'Blendability'
  • Use of ViewData for binding data to a View, as well as a ViewModel to bind behaviour to a view.

In this article, I introduce the topics, and ideas, and explain some of the differences.

In the second article, I'll show the way I set up any project using MVVM#, creating the base classes ready to begin the application specific development.

In the third article, I'll add sufficient meat to the bones created in article 2 to give us a running application, albeit one that doesn't do too much.

In the fourth article, I'll finish off the application to show a (small) but functioning application demonstrating some of the functions available.


I've been looking at MVVM for a while now, without the opportunity to develop real applications using the pattern. I've downloaded and looked at most of the various frameworks, and even understood a few! But I don't like using a framework when I am learning something new - I want to understand the subject from the ground up. So I started playing, developing my own application using MVVM, and re-engineering to surmount the many obstacles I encountered.

In this article, I will describe some of the thought processes that drove me to extend the MVVM pattern, and introduce that pattern.

In the next article in this series, I will walk through developing an application from scratch, in VS2010 using C#, to implement this pattern.

Points of Interest

Man! It's a minefield out there!

There are so many articles, written by the extremely knowledgeable through to the novices, and it is really hard to sort the wheat from the chaff. Debts are due to the WPF Disciples in general, Josh and Marlon in particular, and especially Pete Hanlon who has responded to my often cryptic questions on CodeProject with never a groan! Thanks also go to any of the many people out there in etherland who have helped me, knowingly or not, to develop this series. Isn't it amazing how much free help there is out there? Hopefully, this series will help me give a little back.


If you're trying to wrap your head around MVVM, this article series might help a bit. It's one mans implementation of MVVM, but it sounds like he's "been there, done that" and the article reflects some real world lessons learned. The thing with MVVM is that there seems to be about a billion ways to do it, and until there's an official implementation/guidance in the box,. there's going to continue to be. And while that's kind of neat, it's also a major pain in the butt when you're trying to get up speed on it ...

Anyway, this series provides one of the billion ways. And if this works for you, then you can ignore the other 999,999,999 for now... :)

Monday, January 07, 2013

Kona, Kona, Kona! [Think P&P dev guidance for composite application WinStore Apps {Yes, like Prism, but not}]

Infragistics - Introducing Kona Guidance for Windows 8 Application Development (Think of it as Prism for Windows 8, but not really)

I am extremely excited to announce a new project from the smart people at Microsoft’s Patterns & Practices team called Kona.  What is Kona you ask?  Kona is the new developer guidance for developing line of business applications for Windows 8.  Initially this project was called Prism for WinRT, but as it turns out, it’s really not Prism running on Windows 8, but rather a new set of guidance for developing Windows 8 applications.

Wait… just... a... minute Brian.  What do you mean it’s not “Prism” running on Windows 8?  What do you mean “new guidance”?  Well, if you download Kona and expect to start adding regions and modules like you’re used to, then you might get a bit frustrated looking for the attached properties and IModule interface.  Why?  Well, because it’s not there!  Actually there is a lot of Prism code that you are used to having that is not there and will not be there.  Why do you ask?  The answer is simple; it’s Windows 8.  Huh!?  It’s a new platform, and it has changed significantly compared to WPF and Silverlight.  When they were looking at doing the “port” of Prism, they soon realized that a lot of capabilities just didn’t make sense to bring over to the new platform.  Hence, a new set of guidance using a new set of APIs that are specific to the new Windows 8 platform.

Now not everything was ditched.  Some things, not a lot, made sense to bring over.  DelegateCommand and DelegateCommand<T> is still there.  Guidance on MVVM (Model-View-ViewModel) is still there, but honestly I don’t agree with the implementation.  Keep in mind, this is the first initial drop of Kona, so we can always make improvements to the code base.  Everything is a learning experience.






Interesting. Brian's post is much more complete that you'll find yet on the codeplex page,, but as he said, this is just the first drop... Will be watching for this now though... :)

Friday, October 26, 2012

Sacha Barber shares his WPF/RavenDB/MVVM Diagram Designer application

CodeProject - MVVM Diagram Designer



A while back a user called "sucram (real name Marcus)"  posted a series of articles here about how to create a diagram designer using WPF. Sucrams original links are as follows:

I remember being truly blown away by this series of articles, as they showed you how to do the following things:

  • Toolbox
  • Drag and Drop
  • Rubber band selection using Adorners
  • Resizing items using Adorners
  • Rotating items using Adorners
  • Connecting items
  • Scrollable designer surface, complete with zoombox

WOW that sounds fantastic, sounds exactly like the sort of things you would need to create a fully functional diagram designer. Well Yeah, its was and still is, but........the thing is I have used WPF a lot, and trying to use the code attached to sucrams series of article in WPF just wasn't that great. He had taken a very control centric view, in that everything was geared around adding new controls and supplying static styles for said controls.

In reality it was more like working with a Win Forms application. Not that there is anything wrong with that, and I really truly do not mean to sound ungrateful, as that could not be further from the truth, without that original series of articles it would have taken me a lot longer to come up with a working diagram designer that I was happy with. So for that I am truly grateful, thanks sucram you rock.

Anyway as I say sucrams original codebase took a very control centric point of view, and added controls using code behind, and held collections of items directly in the diagram surface control. As I say if that is what you want cool, however, it was not what I wanted. What I wanted was

  • All of the features of curams original code (actually I didn't want any rotating of items, or resizing of items)
  • A more MVVM driven approach, you know allow data binding of items, delete of items via ICommand etc. etc.
  • Allow me to control the creation of an entire diagram from within a single ViewModel
  • Allow for complex objects to be added to the diagram i.e. ViewModels that I could style using DataTemplate(s). Sucrams original code only allowed simply strings to be used as a DataContext which would control what ImageSource an Image would use to show for a diagram item. I needed my items to be quite rich and allow popups to be shown and associated with the diagram item, such that the data related to the diagram item could be manipulated
  • Allow me to save the diagram to some backing store
  • Allow me to load a previously saved diagram from some backing store

To this end I have pretty much completely re-written sucrams original code, I think there is probably about 2 classes that stayed the same, there is now more code, a lot more, however from an end user experience, I think it is now dead easy to control the creation of diagrams from a centralized ViewModel, which allows a diagram to be created via well known WPF paradigms like Binding/DataTemplating.

For example this is how the attached DemoApp code creates a simple diagram that is shown when you first run the DemoApp:


What Does It Look Like

This is quite interesting, as if you look at the screen shot below and compare that to the final article that sucram produces you probably won't see any difference, which as I previously stated was intentional. I think sucram really nailed it, I just wanted a more WPF style codebase, one that supported Binding etc. etc., so yeah I must admit you could easily look at this screen shot and think "Bah humbug......this is exactly the same", well yes visually speaking I guess it is, however the code is very very different, and the way in which you work with the diagram is very different. Anyway enough chat here is a screen shot.



This project is a demonstration project, and is a good example of how to create your own diagram designer. It is a fully functioning demo, and also demonstrates persisting/hydrating using RavenDB which is a NoSQL document database (as I could not be bothered writing loads of SQL)

Persistence common classes, used by DemoApp

I decided to use RavenDB for persistence which is a NoSQL database, that allows raw C# objects to be stored. I decided to do this, as I really couldn't be bothered to create ALL the SQL to save/hydrate diagrams, and I just wanted to get something up an running ASAP
Though if you use SQL server/MySQL etc. etc., it should be pretty easy to create the stored procedures/data access layer that talks to your preferred SQL database.

This project contains the core classes that are needed to create a diagram in WPF

How Do I Use It In My Own Applications

This section will talk you through how to create a diagram in your own application. It assumes the following

  • That you want to use WPF things like Binding/DataTemplating/MVVM
  • You actually want to persist / hydrate diagrams to some backing store (Like I say I chose to use RavenDB which is a no sql document database, but if this is not for you, it should be pretty easy for you to craft your own data access layer talking to your preferred SQL backend)

If you want to create your own MVVM style diagram designer, I have broken it down into 7 easy steps, as long as you follow these 7 steps to the letter you should be just fine. There is also a working example of these 7 steps by way of the attached DemoApp project code, so you can examine that whilst reading this text, so hopefully you will be ok.

Use It Step 1 : Creating The Raw XAML


Have you clicked through yet? Have you seen the depth and how long this article is? Yeah, wow.

I dig that he used RavenDB. I've been following that product but never used it (or think I've seen in used in a sample/demo I've downloaded). Then of course there's the MVVM goodness and everything else he's showing off. This should keep you code-geeking for a while...:)

Thursday, October 25, 2012

Take two [AvalonDock 2.0 Tutorials] and call...

CodeProject - AvalonDock [2.0] Tutorial Part 1 - Adding a Tool Window

"AvalonDock was written by Adolfo Marinucci. I am in no way involved with the development of AvalonDock but felt that it was time to document some essential things. I am not sure whether I got everything completely right (since I am not the primary developer) but I am building on some experience and simply hope people will give me feedback here if I am making claims that are false.

The first two parts of the tutorial are covering initial preperation steps and adding a Most Recent Files (MRU) tool window and a Start Page. There may be more parts on other AvalonDock subjects (theming, localization, AvalonEdit in AvalonDock 2.0) later. Those who cannot wait for later articles shall look at Edi ( to see some of the things before I document them here. This article was in fact written with Edi.

Solution Preparation

  • Download AvalonDock sources from CodePlex (I used build 96566)
  • Find the version 2.0 Sub-folder and remove all other sub-folders
  • Review the solution in the version 2.0 sub-folder and remove all
    test projects except for AvalonDock.MVVMTestApp
    I ended up removing the sub-projects:
    and was left with:
    AvalonDock (docking layout system library)
    AvalonDock.Theme.VS2010 (theming resources library)
    AvalonDock.Themes.Aero (theming resources library)
    AvalonDock.MVVMTestApp (Test apllication to be extended in this article)
  • Add a new WPF Application project with the application name that you want to develop based on AvalonDock (mine is Edi) and copy files from AvalonDock.MVVMTestApp into the new project. I also resorted some items into folders and namespaces as you can see if you review Your solution should look something like this:

Lets get down to Business

Open the solution and set the Edi project as Startup Project in Visual Studio. Hit the F5 key to check that the application runs OK. I have seen the following content in my case:




CodeProject - AvalonDock [2.0] Tutorial Part 2 - Adding a Start Page


This part of the tutorial, explains how we can add a Start Page to an application that is build on AvalonDock [2.0]. There may be more parts on other AvalonDock subjects (theming, localization, AvalonEdit in AvalonDock 2.0) later. Those who cannot wait for later articles shall look at Edi ( to see some of the things before I document them here. This article was in fact written with Edi.

This article is based on the solution that is described in the previous part 1. We are going to extend the solution in the file attached to the previous article. Therefore, it may be useful to download the file and the attached to this article - since comparing both versions highlights all things that are necessary to implement the Start Page described here.

So lets have a look at the solution in the container.

The ViewModel

The first thing to note is the Edi.ViewModel.StartPageViewModel and the Edi.View.StartPage classes which are both introduced to implement the viewmodel and view of the Start Page item. We also note a new base ViewModel class of the FileBaseViewModel type which is introduced to give the document viewmodels, FileViewModel and StartPageViewModel, a common root. This common root is necessary because the document collection is stored in the Workspace viewmodel:



Is it lame that after all this time I've still not used this awesome component in anything but a quick and dirty play-with app?  I'm green-fielding some WPF app's now, so maybe...  hum...


Related Past Post XRef:
THE open source WinForm & WPF docking library gets overhauled and a new version two, AvalonDock v2's!
AvalonEdit, a (the?) WPF code editor component from the SharpDevelop team (think WPF based, monster cool, code editing, IDE like, uber textbox +10)
Working Workflow into your app's. Workflow Studio, a source available example of rehosting the Workflow Designer

Monday, October 15, 2012

Callisto + Caliburn.Micro + these Dialog Helpers = Happy Windows RT Dev Camper

Mikael Koskinen - Callisto Dialog Helpers for Caliburn.Micro WinRT

Callisto is excellent open source UI Control library for the Windows 8 Store apps. Caliburn.Micro is a powerful framework for building Windows Phone, Silverlight and Windows 8 Store apps. These helpers make it easies to combine Caliburn.Micro with the Callisto's dialogs.


  • Helper for displaying settings dialogs on the Settings charm
  • Helper for displaying normal dialogs all around the screen


The helpers are available as a source code through NuGet:

Install-Package CaliburnMicroWinRTCallistoHelpers

Installing the package will add a Dialogs-folder into your project. This folder contains the source code for the helpers.



This combination looks like a great way to streamline WinRT dev and avoid re-inventing the wheel, letting you focus on what's important, your app...


Related Past Post XRef:
Caliburn.Micro RTW’s (Think a”Lighter/smaller/micro MVVM Framework for WPF, WP7 & Silverlight)

Something for your Metro style app building utility belt, the Callisto toolkit
TWC9: Build sold out, Portable Class Library, eBooks galore, SQLite, WinRT and more

Friday, October 12, 2012

proprt... A C# snippet to speed up the writing of Windows 8/MVVM Properties

The Brain Dump - Windows 8 ViewModel Property Code Snippet

Visual Studio provides a bunch of good code snippets for creating boilerplate code. For example if you type “prop” you get this in intellisense


You’ll see a few nice property snippets.

  • prop – creates a basic automatic property
  • propa – creates an attached property
  • propdp – creates a dependency property
  • propfull – creates a public property with a private backing field
  • propg – creates a basic automatic property but the set is marked private

I use these constantly but hit an issue when building my Windows 8 apps. For ViewModels in Windows 8, the default templates take advantage of a wonderful attribute CallerMemberName in the OnPropertyChanged method of the ViewModel base class. This allows you to create properties that support notifications in a very simple manner. Like this




Funny... I was just looking for something like this. I love the inter-tubes...

Wednesday, October 10, 2012

Navigation, MVVM, XAML and a little IG (Infragistics) in this "Building IG Outlook" video - Building IG Outlook Part 5–Implementing Navigation and MVVM


This is the fifth video in a series that will take you step-by-step on building a Prism application that mimics Microsoft Outlook.  In this video, we implemented our navigation using the Prism navigation APIs as well as some navigation objects we created to provide our navigation path.  We talked a little about INavigationAware interface, IConfirmNavigationRequest interface, and how the View and ViewModel can participate in the Prism navigation process.  DelegateCommand and CompositeCommand were also discussed.  We also implemented our own little MVVM framework which is made up of only two interfaces, IViewBase and IViewModel.  You saw the first glimpse of the EventAggregator and much more.  Wow, we really covered a lot in this video.  Of course we only had time to implement this functionality in the Silverlight version of the application.  So, I went ahead and implemented the same functionality in the WPF version as well.  ..."

I'm in a place now were I can really start working on modern applications (i.e. model based, WPF, MVVM, etc) so I'm now keeping an even sharper eye out for related materials, posts, etc, like this...

Friday, September 14, 2012

Meaning to MVVM (but haven't yet?) Here's a crash course... "Easy MVVM examples (in extreme detail)"

Microsoft Developer Network - Easy MVVM Example

"This project will give you crash course on WPF MVVM that you can do in your lunch break! Everything you need to know about binding, INotifyPropertyChanged, Dependency Objects & Properites, POCO objects, Business Objects, Attached Properties and much more!


Easy MVVM examples (in extreme detail)

This article discusses the various methods and tricks used in MVVM to enable a developer to completely separate the user interface from the code.

Table of Contents


Model View ViewModel is the golden child of WPF, allowing a developer to completely separate their application code from any UI dependencies.

This means an application can be easily be re-skinned and it also makes an application much easier to test.

The View represents any front-end user interface controls (Window, Page, UserControl), the model represents the classes used in the application, and the ViewModel is the middle-man that requests, molds and exposes the data, as properties and commands.

This is article is linked to a TechNet sample project that you can download and explore. It covers many basic concepts of MVVM, and some of the common pitfalls and solutions.


This is one of those helper articles for those that have been meaning to look into/learn/grok MVVM but haven't yet found the time too...

Tuesday, July 10, 2012

MVVM Light Toolkit v4 RTM's

MVVM Light Toolkit - MVVM Light Toolkit V4 RTM

This version supports Silverlight 3, Silverlight 4, Silverlight 5, WPF 3.5 SP1, WPF4, Windows Phone 7.0 and 7.5, WinRT (Windows 8).

Support for Visual Studio 2010 and Visual Studio 2012 RC.

MVVM Light Toolkit

Project Description

The MVVM Light Toolkit is a set of components helping people to get started in the Model - View - ViewModel pattern in Silverlight and WPF. It is a light and pragmatic framework that contains only the essential components needed.

Get started

More information about the MVVM Light Toolkit can be found on


Galasoft - MVVM Light Toolkit

The main purpose of the toolkit is to accelerate the creation and development of MVVM applications in WPF, Silverlight and in the Windows Phone.

Like other MVVM implementations, the toolkit helps you to separate your View from your Model which creates applications that are cleaner and easier to maintain and extend. It also creates testable applications and allows you to have a much thinner user interface layer (which is more difficult to test automatically).

This toolkit puts a special emphasis on the "blendability" of the created application (i.e. the ability to open and edit the user interface into Expression Blend), including the creation of design-time data to enable the Blend users to "see something" when they work with data controls.

Much has been written about MVVM as a pattern. I recommend starting with the following:

Installation and Creation

The MVVM Light Toolkit installation procedure is described here.

To create a new MVVM Light application, check this article (for Visual Studio) and this one (for Expression Blend).


I don't think I've Laurent's MVVM Light Toolkit before (at least not directly). Given this is the v4 RTM, I think it's about time I do...


Related Past Post XRef:
SilverLight 4, RIA Services, MEF and MVVM, oh my… A four part series from the mind of Shawn Wildermuth (updated for VS2010/SL4 RTM)

Thursday, May 03, 2012

From Code-Behind to MVVM, a three part series...

CodeProject - Migrate from Basic to MVVM and MEF Composable Patterns for a Silverlight Application - Part 1


One of my previous posts shows a simple demo application that uses a WCF RIA Services class library with the code first domain data service for CRUD data operations. There are a main screen and a child window with basic navigation and code-behind patterns. What happens if we upgrade the application to that with the MVVM and MEF composable patterns? How easy are the approaches? What are the details of the coding? The article series will address the questions with the easiest approaches and detailed coding explanations. The application, after completed, will not be a full-fledged sample, but should include all major aspects regarding the MVVM and MEF composable pattern implementation without focusing on some other areas such as the UI, data validations, data service operations, or security. I'll also describe how to handle the popup child window with the new patterns, perform the composable part clean-up, and persist the state when switching screens in pure MVVM styles.



CodeProject - Migrate from Basic to MVVM and MEF Composable Patterns for a Silverlight Application - Part 2

"In the Part 1 of the article series, we have started the work on changing to MVVM and MEF composable patterns for a Silverlight application previously with basic navigation and code-behind patterns. By the end of the Part 1, the application is capable of loading a xap, exporting a class module to the composition container, and rendering the same screen to the browser as that before the changes. We will implement the composable MVVM modules for the MainPage user control, the Product List parent screen, and the child window in this part based on the architecture design shown from the beginning of the Part 1.

Contents and Links


CodeProject - Migrate from Basic to MVVM and MEF Composable Patterns for a Silverlight Application - Part 3

"After completing the work described in the previous parts of article series, we have created the main content holder project and upgraded the Product List screen with its child window from basic patterns to the MVVM and MEF composable patterns. In this part, we'll add another demo screen into the ProductApp.Main project and create another set of projects in the solution for a new xap assembly so that we can switch screens between exported modules and xap assemblies. We'll then implement the module clean-up processes and add the state persistence feature into the application.

Contents and Links


While this was targeted at a SilverLight application, there's lessons here for anymore moving a WPF/XAML app from code-behind to MVVM.

Wednesday, May 02, 2012

Wave hello to WAF - WPF Application Framework

CodePlex - WPF Application Framework (WAF)

"The WPF Application Framework (WAF) is a lightweight Framework that helps you to create well structured WPF Applications. It supports you in applying a Layered Architecture and the Model-View-ViewModel (aka MVVM, M-V-VM, PresentationModel) pattern.



  • WPF Application Framework (WAF)
    • ViewModel: Contains types that help you to implement the Model-View-ViewModel Pattern.
    • DataModel: A base class supports you in applying the DataModel-View-ViewModel Pattern.
    • DelegateCommand: The DelegateCommand allows you to handle WPF commands in other classes than the View.
    • INotifyPropertyChanged: The base classes implement the INotifyPropertyChanged interface. The implementation checks the property name in DEBUG mode.
    • WeakEvent: First class support for the WPF WeakEvent Patterns which helps you to avoid memory leaks.
    • Validation: The DataErrorInfoSupport class brings the IDataErrorInfo interface with the DataAnnotations validation framework together.
    • ConverterCollection: This collection is able to keep the DataModels synchronized with an ObservableCollection of Models.
    • Services: Provides services to show a message or the open/save file dialog to the user.
    • Recent Files: The RecentFileList class provides the logic for a recent file list that can be loaded and stored in the application settings.
  • Unit Testing Extensions
    • Exceptions: The ExpectedException method test if an action results in a specified exception.
    • PropertyChanged: Provides a helper method to test if a property changed event is raised when a specific action is executed.
    • CanExecuteChangedEvent: A helper method to test if a CanExecute changed event is raised when a specific action is executed.
  • Samples
    • Email Client: A simple Email Client application that shows how to use the M-V-VM Pattern in a wizard oriented application.
    • Writer: A word processing application which uses a “tabbed MDI” as user interface. This sample shows how to use the Message and FileDialog service.
    • Book Library: Shows how to use the Entity Framework and Validation together with the MVVM pattern.
    • Localization: Demonstrates a simple way to localize a WPF application.


While there's a number of MVVM frameworks available, I thought this one interesting and one I'd like to look deeper into. It's funny what grabs you when you scan a page. In this case, it was the Recent Files class. I hate re-inventing MRU lists (having just done one recently)

Thursday, April 05, 2012

"Everything you wanted to know about databinding..." series (Know it, live it, data bind it...)

ScottLogic - Colin Eberhardt- Everything you wanted to know about databinding in WPF, Silverlight and WP7 (Part One)

"OK, so the title is a little ambitious, but there is nothing wrong with setting yourself lofty aims! Because of the depth of this topic I have decided to split this tutorial up into a series of blog posts, each of which explore a different aspect of the binding framework.

I don’t usually write tutorial blog posts and series, preferring instead to develop new controls or novel techniques. However, I really felt this subject needed an in-depth tutorial. Databinding is a fundamental part of the WPF, Silverlight and the Silverlight for Windows Phone 7 frameworks. It is a powerful concept that once mastered allows you to write concise and elegant code. Yet for all its power, it is a little complex and that is my reason for launching into this blog series.

The rough outline for this series is as follows:

  • Part One – Life before binding, INotifyPropertyChanged and creating bindings in code-behind
  • Part Two – The binding markup extensions, the DataContext and path syntax
  • Part Three – Other binding sources, ElementName, TemplatedParent, TemplateBinding
  • Part Four – Value converters
  • Part Five – List binding


Having recently jumped back into the WPF world for some personal utility app building, I'm again humbled on just how little I know (or have to relearn). You all know that if you WPF (or Silverlight or XAML) and you're not data binding, then you're doing it wrong. Code behind needs to be left behind if at all possible. Sure for the uber-simple app's, it's okay. And for the initial prototype, to get something working it's okay (but watch the techdebt), but there comes a time in the app where the complexity will screen for data binding, separation of concerns, some kind of model, like MVVM. You'll know when that time comes, I'm sure. but the key is building it right'er earlier if you can.

Anyway, this looks like a great series and one I'll be following closely.