Question drawing a mappolygon by markers on the map

vladimir

New member
Joined
Feb 21, 2021
Messages
1
Programming Experience
Beginner
Hey! Please tell me how to draw a mappoligon on the map by placing markers on the map with the mouse.
Here is the code:


C#:
private async void MapControl1_MapTappedAsync (MapControl sender, MapInputEventArgs args) // markers are put here and a polygon is drawn

        {

               var point = new MapIcon();

                Geopoint geo = new Geopoint(args.Location.Position);

                point.Location = geo;

                point.Title = "Point".ToString();

                MapControl1.MapElements.Add(point);

                mapPolygon = new MapPolygon

                {

                    Path = new Geopath(new List<BasicGeoposition> {

                    new BasicGeoposition() {Latitude = point.Location.Position.Latitude, Longitude = point.Location.Position.Longitude },   

                }),

                    ZIndex = 1,

                    FillColor = Colors.Red,

                    StrokeColor = Colors.Blue,

                    StrokeThickness = 2,

                    StrokeDashed = true, 

                };

        }

private void Btn1_Click (object sender, RoutedEventArgs e) // polygon is displayed here

        {

            MapControl1.MapElements.Add (mapPolygon);

        }


mappolygon is not drawing, how can I fix this? Help me please
 
Last edited by a moderator:
Back
Top Bottom