Updating the BaseViewModel to use the navigation service
Now that we have created both our NavigationService
Interface and Class, we will be able to navigate within our ViewModels. The next step is to update the underlying C# code within our BaseViewModel
class. Since our BaseViewModel
class is used by each of our ViewModels, it makes sense to add these additional properties and instance methods within the BaseViewModel
class.
Let's take a look at how we can achieve this by following these steps:
- Open the
BaseViewModel.cs
class, ensuring that it is displayed within the code editor, and enter the following highlighted code sections:
//
// BaseViewModel.cs
// BaseView Model Class that each of our ViewModels will inherit from
//
// Created by Steven F. Daniel on 5/06/2018
// Copyright © 2018 GENIESOFT STUDIOS. All rights reserved.
//
using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
using TrackMyWalks...