Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 77050

Add pin on click Xamarin.Forms.Maps

$
0
0

Hi
I want to add a new pin on clicking on the map using Xamarin.Forms.Maps.
After I've searched I found that I have to use TKCustomMap plugin .. but it didn't shows the map .. just empty area
and this is my code

            double lit = 2.394;// double.Parse(Center.CenterLocationX);
            double longt = 43.2352;// double.Parse(Center.CenterLocationY);
            TK.CustomMap.Position position = new TK.CustomMap.Position(lit, longt);
            TK.CustomMap.MapSpan span = TK.CustomMap.MapSpan.FromCenterAndRadius(position, TK.CustomMap.Distance.FromMiles(0.5));

            TK.CustomMap.TKCustomMap map = new TK.CustomMap.TKCustomMap(span);
            map.IsShowingUser = true;
            map.MapType = TK.CustomMap.MapType.Street;
            TK.CustomMap.TKCustomMapPin pin = new TK.CustomMap.TKCustomMapPin()
            {
                //Address = "Test",
                //Label = "Test",
                Position = position//,
                ,IsDraggable = true
                //Type = PinType.SearchResult
            };
            map.MapClicked += (x, y) =>
            {
                SharedTools.MakeToast("Clicked");
            };
            //map.Pins.Add(pin);
            map.Pins = new List<TK.CustomMap.TKCustomMapPin>() { pin };

            map.MoveToMapRegion(span);
            layout.Content = map;

I want to solve this, or any other idea to add pin on click


Viewing all articles
Browse latest Browse all 77050

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>