Updating the WalksMainPage code-behind using C#
Now that we have updated our WalksMainPageViewModel
to take advantage of our NavigationService
, which will enable our ViewModel to navigate within the navigation stack, the next step is to begin updating the underlying C# code within our WalksMainPage
code-behind file so that it will communicate with our ViewModel so that we can navigate.
Let's take a look at how we can achieve this by following these steps:
- Open the
WalksMainPage.xaml.cs
code-behind file, ensuring that it is displayed within the code editor, and enter the following highlighted code sections:
//
// WalksMainPage.xaml.cs
// Displays Walk Information within a ListView control from an array
//
// Created by Steven F. Daniel on 14/05/2018
// Copyright © 2018 GENIESOFT STUDIOS. All rights reserved.
//
using System;
using TrackMyWalks.Models;
using TrackMyWalks.Services;
using TrackMyWalks.ViewModels;
using Xamarin.Forms;
...