Xamarin Forms GoogleMaps Add Custom Pin Icon With Click Event

This is how I add custom pin icons using Xamarin Forms Xamarin.Forms.GoogleMaps.

On my MainPage view:
1. I create the Map in my Xaml. I use the Xamarin.Forms.GoogleMaps Nuget.
2. I create a List of Location object
3. I do a foreach loop of all the locations
4. I add my “mycustomicon.png” 85px x 85px sized PNG icon. I store the icon in each projects Resource folder (Android\Resources\drawable and iOS\Resources)

namespace MyApp.Models
public class Location
public int ID { get; set; }
public string Content { get; set; }
public string Title { get; set; }
public double Longitude { get; set; }
public double Latitude { get; set; }
protected async override void OnAppearing()
loc = await srv.GetAllLocationsFromSomewhere();
foreach (Models.Location l in loc)
Pin p = new Pin()
Type = PinType.Generic,
Label = l.Title,
Address = l.Content,
Position = new Position(l.Latitude, l.Longitude),
Icon = BitmapDescriptorFactory.FromBundle("mycustomicon.png"),
Tag = l.ID

map.PinClicked += Map_PinClicked;


private void Map_PinClicked(object sender, PinClickedEventArgs e)
            var p = e.Pin;
            p.Label = null; //do this so the infowindow doesnt show.
            var map = (Xamarin.Forms.GoogleMaps.Map)sender as Xamarin.Forms.GoogleMaps.Map;
            Models.TPLocation loc = p.Tag as Models.Location;
            DisplayAlert(loc.Title, loc.Content, "Ok");
11100cookie-checkXamarin Forms GoogleMaps Add Custom Pin Icon With Click Event