To be able to access the navigator we extend the ViewModel base class, making it available to all ViewModels. Proceed as follows:
- In the News project, open the ViewModels folder, and then open the ViewModel.cs file.
- Add the following code marked in bold to the class:
public abstract class ViewModel : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
public INavigate Navigation { get; set; } = new Navigator();
}
The ViewModel now exposes the Navigator property through the INavigate interface, and we are ready to wire up the navigation to our Article view.