menu

MAUI

  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class MapPolygonLayer - MAUI API Reference | Syncfusion

    Show / Hide Table of Contents

    Class MapPolygonLayer

    A sublayer which renders group of MapPolygon on MapShapeLayer and MapTileLayer

    Inheritance
    System.Object
    MapSublayer
    MapPolygonLayer
    Namespace: Syncfusion.Maui.Maps
    Assembly: Syncfusion.Maui.Maps.dll
    Syntax
    public class MapPolygonLayer : MapSublayer
    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

    MapPolygonLayer()

    Initializes a new instance of the MapPolygonLayer class.

    Declaration
    public MapPolygonLayer()
    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

    PolygonsProperty

    Identifies the Polygons bindable property.

    Declaration
    public static readonly BindableProperty PolygonsProperty
    Field Value
    Type
    Microsoft.Maui.Controls.BindableProperty

    Properties

    Polygons

    Gets or sets the collection of polygon. Every single MapPolygon is a closed path which connects multiple location coordinates through group of Points.

    Declaration
    public ObservableCollection<MapPolygon> Polygons { get; set; }
    Property Value
    Type Description
    System.Collections.ObjectModel.ObservableCollection<MapPolygon>

    The polygon 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 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;

    Methods

    OnBindingContextChanged()

    Invoked whenever the binding context of the View changes.

    Declaration
    protected override void OnBindingContextChanged()
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved