In this section, we will take a look at the approaches when performing navigation within ViewModels contained within an Xamarin.Forms
solution. When performing navigation within your ViewModels, there are a couple of approaches that you should consider before going down this path. An approach would be to use the page navigation approach, which involves navigating to another page using a direct reference to that page.
The page navigation approach can be accomplished in Xamarin.Forms
by essentially passing the current INavigation
instance into a ViewModel's object constructor, which will force the ViewModel to use the Xamarin.Forms
default navigation mechanism to navigate to other pages.
If you wanted to use the ViewModel approach to navigate to a page using the associated pages ViewModel, you would need to form some sort of mapping between each of the pages, as well as their associated ViewModels. This would be done by creating a dictionary...