This project is read-only.

What is Auto Mapping MVVM

Auto Mapping MVVM is a simple MVVM kit that works with Windows 8, Windows 8.1 and Windows Phone 8. It was built with the target of being simple and easy to use and since I come from a MVC background I thought that why can't I achieve a similar mapping approach and that's simply what I did. So If you are familiar with normal MVVM libraries you'll know how hectic it is to keep writing the mapping or the navigation dictionary of your app. Auto Mapping MVVM solves this problem by Auto mapping your Views with your View Models.

How do I use Auto Mapping MVVM

Similar To MVC our MVVM library depends on following a certain naming convention. so for example if my View name is MainPage my Viewmodel name is going to be MainPageViewModel.
So Inorder to make use of the library in your project you will have to do the following:

  1. Add the AMMVVMLibrary.Portable dll to your references.
  2. Add either AMMVVMLibrary.W8 or AMMVVMLibrary.WP8 depending on your project either it's Windows 8 / Windows 8.1 or Windows Phone 8.
  3. In your ViewModels you have to extend ViewModalBase.
  4. Add the Navigation Service to your App and you have 3 ways of doing that either manual, auto or hybrid:
    1. For *Auto*:
       ViewModelBase.NavigationService = new AMMVVMLibrary.W8.NavigationService(this.GetType().GetTypeInfo().Assembly);
    2. For *Manual*

      var NavigationService = new AMMVVMLibrary.W8.NavigationService(); NavigationService.ViewModelRouting = new System.Collections.Generic.Dictionary<Type, Type>()  {  { typeof(MainPageViewModel), typeof(MainPage) },  { typeof(ItemPageViewModel), typeof(ItemPage) }  };

    3. For *hybrid*:

      var NavigationService = new AMMVVMLibrary.W8.NavigationService(this.GetType().GetTypeInfo().Assembly); NavigationService.ViewModelRouting = new System.Collections.Generic.Dictionary<Type, Type>()  {  { typeof(ItemPageViewModel), typeof(ItemPage) }  }; ViewModelBase.NavigationService = NavigationService;

Last edited Nov 11, 2013 at 5:19 PM by shehab8887, version 10