Updating the App.xaml class to use the navigation service
Now that we have successfully updated each of our ViewModels
and ContentPages
to take advantage of our NavigationService
so that our ViewModels will be able to navigate to each ViewModel and ContentPage
within the navigation stack, the next step is to make some additional changes within our OnStart
method. We do this in order to declare a NavService
property that will be used to navigate between each of our ViewModels, as well as create an instance of our navigation service class.
Finally, we will see how to register each of our ViewModels and ContentPages
on our navigation stack and check to see what Target OS Platform we are running on so that we can call the appropriate NavigationPage
.
Let's take a look at how we can achieve this by following these steps:
- Open the
App.xaml.cs
file, ensuring that it is displayed within the code editor, and enter the following highlighted code sections:
// // App.xaml.cs // Main class...