amay077 / Xamarin.Forms.GoogleMaps

Map library for Xamarin.Forms using Google maps API
https://www.nuget.org/packages/Xamarin.Forms.GoogleMaps/
MIT License
546 stars 349 forks source link

Map in a ListView - Adding a Pin #591

Closed ianvink closed 5 years ago

ianvink commented 5 years ago

Not a bug.

Awesome tool!!!!

While we wait for the Pin Bindable feature is being added, I used this to add a Pin in a Map that is in a ListView. I use a Message. Simple and works until a Pin Bindable feature comes.

public class MapWithPin : Xamarin.Forms.GoogleMaps.Map
{
    public MapWithPin(): base()
    {
        MessagingCenter.Subscribe<MyViewModel, Pin> (this, "pin", (sender,arg) => {
              this.Pins.Add(arg);
        });
    }
}