How to Setup MvvmCross in the context of a WinRT Background Agent


  • I have a WinRT Metro style application that uses MvvmCross. The application is made up of several DLLs and many of them are taking some dependencies on MvvmCross. For example some of the DLLs use MvvmCross as an IoC container.

    At this point, I would like to add to the application a WinRT background agent. The background agent will reference some of the existing DLLs that have MvvmCross dependencies. Because of this, I  need to set-up MvvmCross in the context of the background agent. Obviously, if this is even possible, the way it is done in a background agent must be different from the way it is done in a WinRT application. In the context of the WinRT application you need to create a “Setup” class inherited from MvxStoreSetup and define a constructor that takes the  root frame (Window.Current.Content) as a parameter. Obviously, in the context of the background agent there is no “root frame”. Also, inheriting a class from MvxStoreSetup in the background agent code will lead to a compiler error:

    Windows Runtime class 'airwatch.ses.winrt.backgroundagent.MvvmCross.Setup' has an invalid base type, 'Cirrious.MvvmCross.WindowsStore.Platform.MvxStoreSetup'.  Classes must derive either from System.Object or from a composable Windows Runtime class.  Implementation inheritance is not allowed.

    Does anyone has any knowledge on how to setup MvvmCross in the context of a WinRT background agent?


    Friday, July 25, 2014 1:34 AM


  • It would be better if you asked on a forum with MVVMCross experts. This is the first I've heard of it.


    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Friday, July 25, 2014 1:33 PM