Introduction

Mugen MVVM Toolkit makes it easier to develop Silverlight, WPF, WinRT and WP applications using the Model-View-ViewModel design pattern. The purpose of the toolkit is to provide a simple framework and set of tools for getting up to speed quickly with applications based on the MVVM design pattern. The core of Toolkit contains a navigation system, windows management system, models, validation, etc. Mugen MVVM Toolkit contains all the MVVM classes such as ViewModelBase, RelayCommand, services, etc.

Features

The MVVM framework includes the following features that differs this project from other frameworks:
  • Solves the nested user controls problem in MVVM, view models are dynamically created by you, using the GetViewModel and GetViewModel<TViewModel> methods. Forget about the ViewModelLocator, in the Toolkit all view models are created dynamically and binding view and view model are on the fly.
[ViewModel(typeof(MainWindowViewModel))]
public partial class MainWindow : Window, IWindowView
{
    public MainWindow()
    {
        InitializeComponent();
    }
}
public class MainWindowViewModel : WindowViewModel
{
}
//View is already created.
var viewModel = GetViewModel<MainWindowViewModel>();

  • No problems with the windows, the windows are presented as view models.
var viewModel = GetViewModel<MainWindowViewModel>();
if (await viewModel.ShowAsync())
{
    //TODO do something                
}
  • A simple binding view with a view-model using the ViewModelAttribute and PageViewModelAttribute attributes.
  • Navigation system works with view models and allows us to expect the completion of the operation. You can pass any parameters between models.
ItemPageViewModel itemPageViewModel = GetViewModel<ItemPageViewModel>();
itemPageViewModel.Initialize(simpleModel);
INavigationResult navigationResult = _navigationProvider.Navigate(itemPageViewModel);
//Wait until operation completed.
navigationResult
    .OperationResultTask
    .ContinueWith(task =>
    {
        _messageBox.ShowAsync(string.Format("Operation completed with result = {0}", task.Result),
            DisplayName);
    });
  • Different kinds of view-models for different occasions, ViewModelBase, WindowViewModelBase, WorkspaceViewModel, EditableViewModel, GridViewModel, ValidatableViewModel, etc.
  • Do not depend on the particular IOC-container, you can use a container that you like. Implementation are already written for the MugenInjection, Ninject, Autofac. (Toolkit uses the IIocAdapter interface.)
  • Async support with transparent marshaling to the UI thread, all events associated with the UI are performed in the UI thread, CanExecuteChanged, CollectionChanged, PropertyChanged, ErrorsChanged, etc.
  • Toolkit includes the thread-safe and notifiable collections:
    • SyncronizedNotifiableCollection – is the same as the ObservableCollection but the thread-safe.
    • FilterableNotifiableCollection - inherited from the SyncronizedNotifiableCollection allows you to specify any filter using a delegate.
    • OrderedNotifiableCollection - inherited from the SyncronizedNotifiableCollection allows you to store ordered values.
  • Toolkit includes the DataAnnotationValidationProvider to validate models using DataAnnotation also supports the custom MetadataTypeAttribute attribute.
  • Toolkit includes the basic validation system that makes it easy to add your validation implementation. Supports asynchronous validation.
  • Toolkit includes the base class (UnitTestBase) to facilitate the testing process.
  • For Windows Phone platform added the BindableApplicationBar class.

Getting Started

The best way to get started is to download and open the samples and see how it is easy to create applications using MVVM pattern.

What's Next?

I plan to put out additional blog posts and write a documentation on using the Mugen MVVM Toolkit and exploring different features.

Last edited Oct 7, 2013 at 4:59 PM by VVS0205, version 11