Skip to content

Instantly share code, notes, and snippets.

@juucustodio
Created February 9, 2018 19:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save juucustodio/95110aeebf9e7a68b3af8629ae8bb35f to your computer and use it in GitHub Desktop.
Save juucustodio/95110aeebf9e7a68b3af8629ae8bb35f to your computer and use it in GitHub Desktop.
Example of how to add pins in maps with click in Xamarin.Forms applications. - http://julianocustodio.com/adicione-pontos-no-maps
using System;
using Xamarin.Forms.Maps;
namespace PinClickDemo
{
public class ExtendedMap : Map
{
public event EventHandler<TapEventArgs> Tap;
public ExtendedMap()
{
}
public ExtendedMap(MapSpan region) : base(region)
{
}
public void OnTap(Position coordinate)
{
OnTap(new TapEventArgs { Position = coordinate });
}
protected virtual void OnTap(TapEventArgs e)
{
var handler = Tap;
if (handler != null) handler(this, e);
}
}
public class TapEventArgs : EventArgs
{
public Position Position { get; set; }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment