Creating the CustomMapOverlay class using C#
In this section, we will take a look at how to create the CustomMapOverlay
class that will inherit from our Xamarin.Forms.Maps
namespace and implement the underlying properties and instance methods. These will be used to create a native map overlay using a CustomRenderer
class for both our iOS and Android platforms.
Let's start by creating the CustomMapOverlay
class by performing the following steps:
- First, create a new
Empty Class
calledCustomMapOverlay
within theViews
folder, as you did in the section entitled Creating and implementing the LocationService class, located within this chapter. - Next, ensure that the
CustomMapOverlay.cs
file is displayed within the code editor and enter the following code snippet:
// // CustomMapOverlay.cs // Displays a custom map overlay using the stored Route Coordinates // // Created by Steven F. Daniel on 28/06/2018 // Copyright © 2018 GENIESOFT STUDIOS. All rights reserved...