Now that we have updated the WalkTrailInfoPage code-behind file so that it communicates with our WalkTrailInfoPageViewModel as well as each of the associated data bindings for the ContentPage that will be used by the ViewModel, the next step is to create and implement the underlying C# code for our ViewModel. This will be used by our WalkDistancePage code-behind file so that it can display information related to the chosen walk trail from our WalksMainPage.
Let's take a look at how we can achieve this by following these steps:
- First, create a new Empty Class called WalkDistancePageViewModel, like you did in the section entitled Creating the WalksMainPageViewModel using C#, located within this chapter.
- Next, ensure that the WalkDistancePageViewModel.cs file is displayed within the code editor and enter the following code snippet...