Creating the WalkEntryPageViewModel using C#
Now that we have updated the WalksMainPage
code-behind file so that it communicates with our WalksMainPageViewModel
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 that will be used by our WalkEntryPage
code-behind file. This allows the user to add or edit walk trail information within our WalkDataModel
data model, as well as validate the information that's provided.
Let's take a look at how we can achieve this by following these steps:
- First, create a new
Empty Class
calledWalkEntryPageViewModel
, like you did in the section entitled Creating the WalksMainPageViewModel using C#, located within this chapter.
- Next, ensure that the
WalkEntryPageViewModel.cs
file is displayed within the code editor and enter the following code snippet:
// // WalkEntryPageViewModel.cs // The ViewModel for our WalkEntryPage...