Map renderer extensibility

JoeMankeJoeManke Joe MankeUSMember ✭✭✭

Description of Change

Makes the Xamarin.Forms.Maps projects more extensible, by unsealing the Pin class and adding hooks in the MapRenderer classes for customization of map and pins.

API Changes


  • protected virtual MarkerOptions MapRenderer.CreateMarker(Pin pin) (Android)
  • protected virtual IMKAnnotation MapRenderer.CreateAnnotation(Pin pin) (iOS)
  • Pin.LabelProperty


  • IOnMapReadyCallback.OnMapReady(GoogleMap map) => public virtual void OnMapReady(GoogleMap map)
  • public sealed class Pin => public class Pin
  • Pin.Label now uses backing BindableProperty LabelProperty

Potential Additional Changes

  • Analog to CreateMarker/CreateAnnotation for Windows platforms

Behavioral Changes

No behavioral changes to existing functionality, reduces need for workarounds when subclassing MapRenderer.


Pull Request

0 votes

Completed · Last Updated

Merged! Should be available in 2.3.5. Thank you!


  • AdamMeaneyAdamMeaney Adam Meaney USMember ✭✭✭

    Since this is now merged, it should probably be closed.

  • JoeMankeJoeManke Joe Manke USMember ✭✭✭

    So the pull request linked in original post has been merged and is part of Xamarin.Forms 2.3.5-pre1, but in my own testing of that release I'm finding that I wasn't thorough enough on iOS. I think the (currently internal) MapDelegate class needs to be exposed or somehow modified, so that custom renderers can hook into the GetViewForAnnotation method and customize how their pins are rendered. For example, in my renderer I do a switch on the PinType to change the color of the pin. One can of course just set their own method as the GetViewForAnnotation delegate on the native MKMapView, but then you lose the implementation of the Pin.Clicked event.

Sign In or Register to comment.