alexa
Syncfusion
menu Syncfusion

MAUI

  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Search Results for

    Show / Hide Table of Contents

    Class MapPolygon

    The MapPolygon represents the default model for polygon layer.

    Inheritance
    object
    MapPolygon
    Namespace: Syncfusion.Maui.Maps
    Assembly: Syncfusion.Maui.Maps.dll
    Syntax
    public class MapPolygon : Element
    Examples
    • XAML
    • C#
    <map:SfMaps>
        <map:SfMaps.Layer>
             <map:MapShapeLayer ShapesSource = "https://cdn.syncfusion.com/maps/map-data/world-map.json">
                <map:MapShapeLayer.Sublayers>
                    <map:MapPolygonLayer>
                        <map:MapPolygonLayer.Polygons>
                            <map:MapPolygon Fill = "LightGreen"
                                            Stroke="Green"
                                            StrokeThickness="4">
                                <map:MapPolygon.Points>
                                    <map:MapLatLng Latitude="5.562764"
                                                   Longitude="101.470795" />
                                    <map:MapLatLng Latitude="-19.138292"
                                                   Longitude="44.822302" />
                                    <map:MapLatLng Latitude="-23.391278"
                                                   Longitude="124.580986" />
                                </map:MapPolygon.Points>
                            </map:MapPolygon>
                        </map:MapPolygonLayer.Polygons>
                    </map:MapPolygonLayer>
                </map:MapShapeLayer.Sublayers>
            </map:MapShapeLayer>
        </map:SfMaps.Layer>
    </map:SfMaps>
    SfMaps maps = new SfMaps();
    MapShapeLayer layer = new MapShapeLayer();
    layer.ShapesSource = MapSource.FromUri(new Uri("https://cdn.syncfusion.com/maps/map-data/world-map.json"));
    MapPolygonLayer mapPolygonLayer = new MapPolygonLayer();
    MapPolygon polygon = new MapPolygon();
    polygon.Points = new ObservableCollection<MapLatLng>()
    {
       new MapLatLng(5.562764, 101.470795),
       new MapLatLng(-19.138292, 44.822302),
       new MapLatLng(-23.391278, 124.580986)
    };
    polygon.Fill = Brush.LightGreen;
    polygon.Stroke = Brush.Green;
    polygon.StrokeThickness = 4;
    mapPolygonLayer.Polygons.Add(polygon);
    layer.Sublayers.Add(mapPolygonLayer);
    maps.Layer = layer;
    this.Content = maps;

    Constructors

    MapPolygon()

    Initializes a new instance of the MapPolygon class.

    Declaration
    public MapPolygon()
    Examples
    • XAML
    • C#
    <map:SfMaps>
        <map:SfMaps.Layer>
             <map:MapShapeLayer ShapesSource = "https://cdn.syncfusion.com/maps/map-data/world-map.json">
                <map:MapShapeLayer.Sublayers>
                    <map:MapPolygonLayer>
                        <map:MapPolygonLayer.Polygons>
                            <map:MapPolygon Fill = "LightGreen"
                                            Stroke="Green"
                                            StrokeThickness="4">
                                <map:MapPolygon.Points>
                                    <map:MapLatLng Latitude="5.562764"
                                                   Longitude="101.470795" />
                                    <map:MapLatLng Latitude="-19.138292"
                                                   Longitude="44.822302" />
                                    <map:MapLatLng Latitude="-23.391278"
                                                   Longitude="124.580986" />
                                </map:MapPolygon.Points>
                            </map:MapPolygon>
                        </map:MapPolygonLayer.Polygons>
                    </map:MapPolygonLayer>
                </map:MapShapeLayer.Sublayers>
            </map:MapShapeLayer>
        </map:SfMaps.Layer>
    </map:SfMaps>
    SfMaps maps = new SfMaps();
    MapShapeLayer layer = new MapShapeLayer();
    layer.ShapesSource = MapSource.FromUri(new Uri("https://cdn.syncfusion.com/maps/map-data/world-map.json"));
    MapPolygonLayer mapPolygonLayer = new MapPolygonLayer();
    MapPolygon polygon = new MapPolygon();
    polygon.Points = new ObservableCollection<MapLatLng>()
    {
       new MapLatLng(5.562764, 101.470795),
       new MapLatLng(-19.138292, 44.822302),
       new MapLatLng(-23.391278, 124.580986)
    };
    polygon.Fill = Brush.LightGreen;
    polygon.Stroke = Brush.Green;
    polygon.StrokeThickness = 4;
    mapPolygonLayer.Polygons.Add(polygon);
    layer.Sublayers.Add(mapPolygonLayer);
    maps.Layer = layer;
    this.Content = maps;

    Fields

    FillProperty

    Identifies the Fill bindable property.

    Declaration
    public static readonly BindableProperty FillProperty
    Field Value
    Type
    BindableProperty

    PointsProperty

    Identifies the Points bindable property.

    Declaration
    public static readonly BindableProperty PointsProperty
    Field Value
    Type
    BindableProperty

    StrokeProperty

    Identifies the Stroke bindable property.

    Declaration
    public static readonly BindableProperty StrokeProperty
    Field Value
    Type
    BindableProperty

    StrokeThicknessProperty

    Identifies the StrokeThickness bindable property.

    Declaration
    public static readonly BindableProperty StrokeThicknessProperty
    Field Value
    Type
    BindableProperty

    Properties

    Fill

    Gets or sets the brush that paints the interior area of the polygon.

    Declaration
    public Brush Fill { get; set; }
    Property Value
    Type Description
    Brush

    A Brush that specifies how the map polygon interior is painted.

    Examples
    • XAML
    • C#
    <map:SfMaps>
        <map:SfMaps.Layer>
             <map:MapShapeLayer ShapesSource = "https://cdn.syncfusion.com/maps/map-data/world-map.json">
                <map:MapShapeLayer.Sublayers>
                    <map:MapPolygonLayer>
                        <map:MapPolygonLayer.Polygons>
                            <map:MapPolygon Fill = "LightGreen">
                                <map:MapPolygon.Points>
                                    <map:MapLatLng Latitude="5.562764"
                                                   Longitude="101.470795" />
                                    <map:MapLatLng Latitude="-19.138292"
                                                   Longitude="44.822302" />
                                    <map:MapLatLng Latitude="-23.391278"
                                                   Longitude="124.580986" />
                                </map:MapPolygon.Points>
                            </map:MapPolygon>
                        </map:MapPolygonLayer.Polygons>
                    </map:MapPolygonLayer>
                </map:MapShapeLayer.Sublayers>
            </map:MapShapeLayer>
        </map:SfMaps.Layer>
    </map:SfMaps>
    SfMaps maps = new SfMaps();
    MapShapeLayer layer = new MapShapeLayer();
    layer.ShapesSource = MapSource.FromUri(new Uri("https://cdn.syncfusion.com/maps/map-data/world-map.json"));
    MapPolygonLayer mapPolygonLayer = new MapPolygonLayer();
    MapPolygon polygon = new MapPolygon();
    polygon.Points = new ObservableCollection<MapLatLng>()
    {
       new MapLatLng(5.562764, 101.470795),
       new MapLatLng(-19.138292, 44.822302),
       new MapLatLng(-23.391278, 124.580986)
    };
    polygon.Fill = Brush.LightGreen;
    mapPolygonLayer.Polygons.Add(polygon);
    layer.Sublayers.Add(mapPolygonLayer);
    maps.Layer = layer;
    this.Content = maps;

    Points

    Gets or sets the collection of geolocation coordinates of the polygon to be drawn.

    Declaration
    public IList<MapLatLng> Points { get; set; }
    Property Value
    Type Description
    IList<MapLatLng>

    The points collection. By default, the collection is empty.

    Examples
    • XAML
    • C#
    <map:SfMaps>
        <map:SfMaps.Layer>
             <map:MapShapeLayer ShapesSource = "https://cdn.syncfusion.com/maps/map-data/world-map.json">
                <map:MapShapeLayer.Sublayers>
                    <map:MapPolygonLayer>
                        <map:MapPolygonLayer.Polygons>
                            <map:MapPolygon>
                                <map:MapPolygon.Points>
                                    <map:MapLatLng Latitude="5.562764"
                                                   Longitude="101.470795" />
                                    <map:MapLatLng Latitude="-19.138292"
                                                   Longitude="44.822302" />
                                    <map:MapLatLng Latitude="-23.391278"
                                                   Longitude="124.580986" />
                                </map:MapPolygon.Points>
                            </map:MapPolygon>
                        </map:MapPolygonLayer.Polygons>
                    </map:MapPolygonLayer>
                </map:MapShapeLayer.Sublayers>
            </map:MapShapeLayer>
        </map:SfMaps.Layer>
    </map:SfMaps>
    SfMaps maps = new SfMaps();
    MapShapeLayer layer = new MapShapeLayer();
    layer.ShapesSource = MapSource.FromUri(new Uri("https://cdn.syncfusion.com/maps/map-data/world-map.json"));
    MapPolygonLayer mapPolygonLayer = new MapPolygonLayer();
    MapPolygon polygon = new MapPolygon();
    polygon.Points = new ObservableCollection<MapLatLng>()
    {
       new MapLatLng(5.562764, 101.470795),
       new MapLatLng(-19.138292, 44.822302),
       new MapLatLng(-23.391278, 124.580986)
    };
    mapPolygonLayer.Polygons.Add(polygon);
    layer.Sublayers.Add(mapPolygonLayer);
    maps.Layer = layer;
    this.Content = maps;

    Stroke

    Gets or sets the brush that paints the stroke area of the polygon.

    Declaration
    public Brush Stroke { get; set; }
    Property Value
    Type Description
    Brush

    A Brush that specifies how the map polygon outline is painted.

    Examples
    • XAML
    • C#
    <map:SfMaps>
        <map:SfMaps.Layer>
             <map:MapShapeLayer ShapesSource = "https://cdn.syncfusion.com/maps/map-data/world-map.json">
                <map:MapShapeLayer.Sublayers>
                    <map:MapPolygonLayer>
                        <map:MapPolygonLayer.Polygons>
                            <map:MapPolygon Fill = "LightGreen"
                                            Stroke="Green">
                                <map:MapPolygon.Points>
                                    <map:MapLatLng Latitude="5.562764"
                                                   Longitude="101.470795" />
                                    <map:MapLatLng Latitude="-19.138292"
                                                   Longitude="44.822302" />
                                    <map:MapLatLng Latitude="-23.391278"
                                                   Longitude="124.580986" />
                                </map:MapPolygon.Points>
                            </map:MapPolygon>
                        </map:MapPolygonLayer.Polygons>
                    </map:MapPolygonLayer>
                </map:MapShapeLayer.Sublayers>
            </map:MapShapeLayer>
        </map:SfMaps.Layer>
    </map:SfMaps>
    SfMaps maps = new SfMaps();
    MapShapeLayer layer = new MapShapeLayer();
    layer.ShapesSource = MapSource.FromUri(new Uri("https://cdn.syncfusion.com/maps/map-data/world-map.json"));
    MapPolygonLayer mapPolygonLayer = new MapPolygonLayer();
    MapPolygon polygon = new MapPolygon();
    polygon.Points = new ObservableCollection<MapLatLng>()
    {
       new MapLatLng(5.562764, 101.470795),
       new MapLatLng(-19.138292, 44.822302),
       new MapLatLng(-23.391278, 124.580986)
    };
    polygon.Fill = Brush.LightGreen;
    polygon.Stroke = Brush.Green;
    mapPolygonLayer.Polygons.Add(polygon);
    layer.Sublayers.Add(mapPolygonLayer);
    maps.Layer = layer;
    this.Content = maps;

    StrokeThickness

    Gets or sets the value that specifies the width of the polygon stroke outline.

    Declaration
    public double StrokeThickness { get; set; }
    Property Value
    Type Description
    double

    It specifies the width of the map polygon stroke outline. The default value is 2.

    Examples
    • XAML
    • C#
    <map:SfMaps>
        <map:SfMaps.Layer>
             <map:MapShapeLayer ShapesSource = "https://cdn.syncfusion.com/maps/map-data/world-map.json">
                <map:MapShapeLayer.Sublayers>
                    <map:MapPolygonLayer>
                        <map:MapPolygonLayer.Polygons>
                            <map:MapPolygon Fill = "LightGreen"
                                            Stroke="Green"
                                            StrokeThickness="4">
                                <map:MapPolygon.Points>
                                    <map:MapLatLng Latitude="5.562764"
                                                   Longitude="101.470795" />
                                    <map:MapLatLng Latitude="-19.138292"
                                                   Longitude="44.822302" />
                                    <map:MapLatLng Latitude="-23.391278"
                                                   Longitude="124.580986" />
                                </map:MapPolygon.Points>
                            </map:MapPolygon>
                        </map:MapPolygonLayer.Polygons>
                    </map:MapPolygonLayer>
                </map:MapShapeLayer.Sublayers>
            </map:MapShapeLayer>
        </map:SfMaps.Layer>
    </map:SfMaps>
    SfMaps maps = new SfMaps();
    MapShapeLayer layer = new MapShapeLayer();
    layer.ShapesSource = MapSource.FromUri(new Uri("https://cdn.syncfusion.com/maps/map-data/world-map.json"));
    MapPolygonLayer mapPolygonLayer = new MapPolygonLayer();
    MapPolygon polygon = new MapPolygon();
    polygon.Points = new ObservableCollection<MapLatLng>()
    {
       new MapLatLng(5.562764, 101.470795),
       new MapLatLng(-19.138292, 44.822302),
       new MapLatLng(-23.391278, 124.580986)
    };
    polygon.Fill = Brush.LightGreen;
    polygon.Stroke = Brush.Green;
    polygon.StrokeThickness = 4;
    mapPolygonLayer.Polygons.Add(polygon);
    layer.Sublayers.Add(mapPolygonLayer);
    maps.Layer = layer;
    this.Content = maps;
    In this article
    Back to top Generated by DocFX
    Copyright © 2001 - 2026 Syncfusion Inc. All Rights Reserved