View Model Page Navigation with MVVM Light

When you move from code behind to a View Model (as you should, if only to make testing easier) certain challenges arise, such as: how do I navigate to another page?

Fortunately, MVVM Light provides a Messaging bus, that makes it easy to send messages from a View Model to a page (or to another View Model). This can be over done but when used judiciously it makes the very difficult into the very easy.

Begin by creating a parent for ContentPage (I called mine BaseViewPage). Have your content pages derive from the new page. In the new page we’ll register to receive Navigation Messages from the Messenger Bus

About Jesse Liberty

Jesse Liberty is a Senior Consultant with Wintellect, with three decades of experience writing and delivering software projects. He is the author of 2 dozen books and multiple Pluralsight & LinkedIn Learning courses, and has been a Senior Technical Evangelist for Microsoft, a Distinguished Software Engineer for AT&T, a VP for Information Services for Citibank and a Software Architect for PBS. He is a Xamarin Certified Mobile Developer and a Xamarin MVP and a Microsoft MVP.