MEF and MVVM – Code Sample Browser

The Managed Extensibility Framework (also known as MEF) allows for extensible application design by providing services necessary to decouple application modules and packages.

MEFedMVVM is a framework available on CodePlex that extends the MEF concept to include the MVVM pattern for both WPF and Silverlight.

blocks    silverlight_logo

I used MEFedMVVM to create a lightweight code sample browser application to demonstrate a simple use of the MVVM pattern in Silverlight that employs MEF to couple such common services as a singleton model and view model messenger (mediator).

See it in Action
The code sample browser application is used to host the public code sample repository here:

The download archive is available here:

Code Structure
The code sample browser is divided into five projects and uses MEF to import and export implementations between the different modules. MEFedMVVM is used to connect the views with their respective view-models. The five projects and their purposes are as follows:

The main Silverlight application. This contains the xaml files that implement the views, styles, and converters necessary to present the application.

This project contains the view-models that provide the functional interface to the application. The two main view models provide interfaces for the code sample list (navigation) and code sample detail layouts.

The model and core system code. The runtime implementation of ICodeBrowserModel is declared and exported as a singleton.

POCOs (Plain Old CLR Objects) are declared here. They form the currency used to communicate domain values between modules.

A simple ASP.NET project used to host the Silverlight application during development.


Disclaimer: This code is provided as is, without warranty, and without guarantee of fitness for any purpose. Use at your own risk.

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *