MvvmLight Navigation Extension

When navigating in iOS we can choose to do a modal navigation. That means that we open a page that is on top of the other pages and not included in the navigation stack. When using MvvmLight we only have one method (NavigateTo) when we want to open a new page.

While I want to use MvvmLight and open "modals" I have created a MvvmLight extension for iOS (for storyboards only in this pre version) and Android, If you're interested in the source, it will be at GitHub,

While this is a pre release, feedback is very welcome!

Using the extension from shared code
To use it in your ViewModels you need to add the namespace to the class.

using MvvmLightNavigationExtension;
var navigation = ServiceLocator.Current.GetInstance();

We will configure the NavigationService in same way as when we using NavigationService from MvvmLight but we using NavigationServiceExtension() instead of NavigationService and our instance of NavigationServiceExtension should be registered to both INavigationService and INavigationServiceExtension.


 var nav = new MvvmLightNavigationExtension.iOS.NavigationServiceExtension();
 nav.Configure("Page1", "MainView");
 nav.Configure("Page2", "PageView");


 var nav = new MvvmLightNavigationExtension.Droid.NavigationServiceExtension();
 nav.Configure("Page1", "MainView");
 nav.Configure("Page2", "PageView");

2 thoughts on “MvvmLight Navigation Extension

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.