Created
February 9, 2018 19:03
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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