looking for some solutions? You are welcome.

SOLVED: Add pin on click Xamarin.Forms.Maps

Amir Imam:

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



Posted in S.E.F
via StackOverflow & StackExchange Atomic Web Robots
Share:

No comments:

Recent