how many pins in xamarin map?

DuckDeokDuckDeok Member ✭✭

how many pins in xamarin map?

i make 20 pins in xamarin map, but in the map show 20 less pins.

i wanna make more pins, how can i do?

Answers

  • Marcel_NaritaMarcel_Narita Member ✭✭

    Try with:
    https://developer.xamarin.com/api/type/Xamarin.Forms.Maps.Pin/

    protected override void OnElementChanged(ElementChangedEventArgs<View> e)
    {
        base.OnElementChanged(e);
    
        if (e.OldElement != null) return;
    
        var map = this.Control as MKMapView;
        if(map == null) return;
    
        map.AddGestureRecognizer(new UILongPressGestureRecognizer(MapLongPress));
    
    }
    
    private void MapLongPress(UILongPressGestureRecognizer recognizer)
    {
        if (recognizer.State != UIGestureRecognizerState.Began) return;
    
        var map = this.Control as MKMapView;
    
        if(map == null) return;
    
        var pixelLocation = recognizer.LocationInView(map);
        var geoCoordinate = map.ConvertPoint(pixelLocation, map);
    
        // Add new pin with the coordinate
    }
    

    for more, read this :smile: https://docs.microsoft.com/en-gb/xamarin/xamarin-forms/user-interface/map

Sign In or Register to comment.