Once the namespace is declared, the prefix is used to reference the custom map. However, the clr-namespace and assembly values must match the details of the custom map. The local namespace prefix can be named anything. The following code example shows how the CustomMap control can be consumed by a XAML page: NET Standard library project by declaring a namespace for its location and using the namespace prefix on the custom map control. The CustomMap control can be referenced in XAML in the. This class defines a CustomPin as inheriting the properties of the Pin class, and adding Name and Url properties. The CustomPin class is shown in the following code example: public class CustomPin : Pin The custom map exposes the CustomPins property that represents the collection of CustomPin objects that will be rendered by the native map control on each platform. NET Standard library project and defines the API for the custom map. Creating the Custom MapĪ custom map control can be created by subclassing the Map class, as shown in the following code example: public class CustomMap : Map
![create a custom map with pins create a custom map with pins](https://ardalis.com/static/aeac8a8e915501fc83b112b8aec51845/a5d70/google-maps-menu-expanded.png)
must be initialized and configured before use.
#Create a custom map with pins android#
On the Android platform, the MapRenderer class instantiates a native MapView control.
![create a custom map with pins create a custom map with pins](https://www.google.com/maps/about/images/mymaps/mymaps-desktop-16x9.png)
When a Map is rendered by a Xamarin.Forms application in iOS, the MapRenderer class is instantiated, which in turn instantiates a native MKMapView control.
#Create a custom map with pins how to#
This article demonstrates how to create a custom renderer for the Map control, which displays a native map with a customized pin and a customized view of the pin data on each platform.Įvery Xamarin.Forms view has an accompanying renderer for each platform that creates an instance of a native control.