MVVM Cross Upgrade to 4.2.2

August 06, 2016

Coming back to MVVMCross and trying to create a new project, I found that some of the documentation available for the new version (4.2.2 at the time of writing this) is no longer correct; for example, the ToDo file in the sample projects still looks like this:

The steps to get this Store UI working are:

  1. Add a reference to your Core PCL project

  2. Change App.Xaml.cs so that it creates a ‘new Setup(RootFrame)’ during its OnLaunched:

     protected override void OnLaunched(LaunchActivatedEventArgs args)
         var rootFrame = Window.Current.Content as Frame;
         // Do not repeat app initialization when the Window already has content,
         // just ensure that the window is active
         if (rootFrame == null)
             // Create a Frame to act as the navigation context and navigate to the first page
             rootFrame = new Frame();
             if (args.PreviousExecutionState == ApplicationExecutionState.Terminated)
                 //TODO: Load state from previously suspended application
             // Place the frame in the current Window
             Window.Current.Content = rootFrame;
         if (rootFrame.Content == null)
             // When the navigation stack isn't restored navigate to the first page,
             // configuring the new page by passing required information as a navigation
             // parameter
             var setup = new Setup(rootFrame);
             var start = MvvmCross.Core.Mvx.Resolve();
         // Ensure the current window is active
  3. For Windows 8 - Add a views folder and a view - xaml.cs and .xaml based on BasicPage - this will add 5 files to the Common folder.

  • Change the Common/LayoutAwarePage.cs inheritance to MvvmCross.WindowsStore.Views.MvxStorePage
  • Change the Common/LayoutAwarePage.cs - remove the OnNavigatedTo and OnNavigatedFrom handlers
  • Add some content for your Xaml - e.g. 5. For Windows 8.1 - Add a views folder and a view based on the BasicPage template
  • In the .xaml.cs - remove public NavigationHelper NavigationHelper and all referencing code
  • In the .xaml.cs - remove the OnNavigatedTo and OnNavigatedFrom handlers
  • Add some content for your Xaml - e.g.

This document was very useful. I was looking specifically at the Babel project in the above sample; this won’t compile under MvvmCross 4.2.2. I’ve listed here everything I needed to do to make it.

Mvx has now been replaced with MvxSimpleIoCContainer.Instance

In App.xaml.cs:

var start = MvxSimpleIoCContainer.Instance.Resolve<IMvxAppStart>();

Is now:

var start = MvxSimpleIoCContainer.Instance.Resolve<IMvxAppStart>();

In App.cs:

        private void InitializeText()
            var builder = new TextProviderBuilder();

Is now is a separate plug-in by the looks of things:


The new code is:

        private void InitializeText()
            var builder = new TextProviderBuilder();

Profile picture

A blog about one man's journey through code… and some pictures of the Peak District

© Paul Michaels 2022