In this section, we will proceed to create our TrackMyWalks model that will represent our walk entries. As we progress throughout this chapter, we will see how we can use this model to set up and initialize some walk entries for our main WalksPage using a ListView
control so that we can display walk entry for each row within the ListView
.
Let's take a look at how we can achieve this, by following the steps below:
TrackMyWalks
Portable Class Library project solution, called Models
as shown in the following screenshot:
Models
folder, as shown in the following screenshot:
WalkEntries
for the name of the new class file to be created as shown in the following screenshot:
Congratulations, you have created your first folder and C# class file for our solution. We can now proceed with adding the property descriptors that will be used to define our model.
WalkEntries.cs
file is displayed, then locate the WalkEntries
class constructor and enter the following highlighted code sections:// // WalkEntries.cs // TrackMyWalks // // Created by Steven F. Daniel on 04/08/2016. // Copyright © 2016 GENIESOFT STUDIOS. All rights reserved. // namespace TrackMyWalks.Models { public class WalkEntries { public string Title { get; set; } public string Notes { get; set; } public double Longitude { get; set; } public double Latitude { get; set; } public double Kilometers { get; set; } public string Difficulty { get; set; } public double Distance { get; set; } public string ImageUrl { get; set; } } }
In the preceding code snippet, we have successfully defined the model that will be used to represent our walk entries. In the next section, we will use this model to set up and initialize some walk entries for our main WalksPage
using a ListView
control, then use a DataTemplate
to describe how the model data should be displayed for each row within the ListView
.
3.138.120.136