MAUIverse MAUIverse

Customizing Map Pins in .NET MAUI

Written while the Maps control was still new to .NET MAUI, this post answers a common question: how do you show your own image instead of the default pin? Vladislav starts with the Microsoft.Maui.Controls.Maps package and a CustomPin that adds an ImageSource bindable property.

On Android, a CustomMapHandler keeps track of the map elements it adds, updates, and removes, and it refreshes pins from a map-ready callback once the Google map is available. iOS and Mac Catalyst need a bit more work: a CustomAnnotation stores the pin’s UIImage, and the handler loads images and supplies the annotation view when the map asks for it. Registering the handlers in MauiProgram ties it together.

Anyone building a location-based app who wants branded markers will find the handler code here a useful starting point. The full code is on GitHub.

View Source →

← Back to Community Feed

}