menu

MAUI

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

    Show / Hide Table of Contents

    Class MapLine

    The MapLine represents the default model for line layer.

    Inheritance
    System.Object
    MapLine
    Namespace: Syncfusion.Maui.Maps
    Assembly: Syncfusion.Maui.Maps.dll
    Syntax
    public class MapLine : Element, IThemeElement
    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:MapLineLayer>
                         <map:MapLineLayer.Lines>
                             <map:MapLine StrokeThickness = "3"
                                          StrokeLineCap="Round"
                                          Stroke="LightGreen">
                                 <map:MapLine.From>
                                     <map:MapLatLng Latitude="26.841944"
                                                    Longitude="114.561183" />
                                 </map:MapLine.From>
                                  <map:MapLine.To>
                                     <map:MapLatLng Latitude="37.316207" 
                                                    Longitude="89.494558" />
                                 </map:MapLine.To>
                                 <map:MapLine.StrokeDashArray>
                                      <DoubleCollection>
                                         <x:Double>2</x:Double>
                                         <x:Double>2</x:Double>
                                         <x:Double>0.1</x:Double>
                                         <x:Double>2</x:Double>
                                     </DoubleCollection>
                                </map:MapLine.StrokeDashArray>
                             </map:MapLine>
                          </map:MapLineLayer.Lines>
                     </map:MapLineLayer>
                 </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"));
    MapLineLayer mapLineLayer = new MapLineLayer();
    MapLine line = new MapLine();
    line.From = new MapLatLng(26.841944, 114.561183);
    line.To = new MapLatLng(37.316207, 89.494558);
    line.StrokeThickness = 3;
    line.StrokeLineCap = LineCap.Round;
    line.Stroke = Brush.LightGreen;
    line.StrokeDashArray = new double[] { 2, 2, 0.1, 2 };
    mapLineLayer.Lines.Add(line);
    layer.Sublayers.Add(mapLineLayer);
    maps.Layer = layer;
    this.Content = maps;

    Constructors

    MapLine()

    Initializes a new instance of the MapLine class.

    Declaration
    public MapLine()

    Fields

    FromProperty

    Identifies the From bindable property.

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

    StrokeDashArrayProperty

    Identifies the StrokeDashArray bindable property.

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

    StrokeLineCapProperty

    Identifies the StrokeLineCap bindable property.

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

    StrokeProperty

    Identifies the Stroke bindable property.

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

    StrokeThicknessProperty

    Identifies the StrokeThickness bindable property.

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

    ToProperty

    Identifies the To bindable property.

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

    Properties

    From

    Gets or sets the value that specifies the start point of line.

    Declaration
    public MapLatLng From { get; set; }
    Property Value
    Type Description
    MapLatLng

    The from value of the map line. The default is null.

    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:MapLineLayer>
                         <map:MapLineLayer.Lines>
                             <map:MapLine>
                                 <map:MapLine.From>
                                     <map:MapLatLng Latitude="26.841944"
                                                    Longitude="114.561183" />
                                 </map:MapLine.From>
                                  <map:MapLine.To>
                                     <map:MapLatLng Latitude="37.316207" 
                                                    Longitude="89.494558" />
                                 </map:MapLine.To>
                             </map:MapLine>
                          </map:MapLineLayer.Lines>
                     </map:MapLineLayer>
                 </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"));
    MapLineLayer mapLineLayer = new MapLineLayer();
    MapLine line = new MapLine();
    line.From = new MapLatLng(26.841944, 114.561183);
    line.To = new MapLatLng(37.316207, 89.494558);
    mapLineLayer.Lines.Add(line);
    layer.Sublayers.Add(mapLineLayer);
    maps.Layer = layer;
    this.Content = maps;

    Stroke

    Gets or sets the brush that used to paints the line.

    Declaration
    public Brush Stroke { get; set; }
    Property Value
    Type Description
    Microsoft.Maui.Controls.Brush

    A Brush that specifies how the map line 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:MapLineLayer>
                         <map:MapLineLayer.Lines>
                             <map:MapLine StrokeThickness = "3"
                                          StrokeLineCap="Round"
                                          Stroke="LightGreen">
                                 <map:MapLine.From>
                                     <map:MapLatLng Latitude="26.841944"
                                                    Longitude="114.561183" />
                                 </map:MapLine.From>
                                  <map:MapLine.To>
                                     <map:MapLatLng Latitude="37.316207" 
                                                    Longitude="89.494558" />
                                 </map:MapLine.To>
                             </map:MapLine>
                          </map:MapLineLayer.Lines>
                     </map:MapLineLayer>
                 </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"));
    MapLineLayer mapLineLayer = new MapLineLayer();
    MapLine line = new MapLine();
    line.From = new MapLatLng(26.841944, 114.561183);
    line.To = new MapLatLng(37.316207, 89.494558);
    line.StrokeThickness = 3;
    line.StrokeLineCap = LineCap.Round;
    line.Stroke = Brush.LightGreen;
    mapLineLayer.Lines.Add(line);
    layer.Sublayers.Add(mapLineLayer);
    maps.Layer = layer;
    this.Content = maps;

    StrokeDashArray

    Gets or sets the value collection of double values that specifies the pattern of dashes and gaps that are used to outline of the line.

    Declaration
    public DoubleCollection StrokeDashArray { get; set; }
    Property Value
    Type Description
    Microsoft.Maui.Controls.DoubleCollection

    The dash value of the map line. The default is null.

    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:MapLineLayer>
                         <map:MapLineLayer.Lines>
                             <map:MapLine StrokeThickness = "3"
                                          StrokeLineCap="Round"
                                          Stroke="LightGreen">
                                 <map:MapLine.From>
                                     <map:MapLatLng Latitude="26.841944"
                                                    Longitude="114.561183" />
                                 </map:MapLine.From>
                                  <map:MapLine.To>
                                     <map:MapLatLng Latitude="37.316207" 
                                                    Longitude="89.494558" />
                                 </map:MapLine.To>
                                 <map:MapLine.StrokeDashArray>
                                      <DoubleCollection>
                                         <x:Double>2</x:Double>
                                         <x:Double>2</x:Double>
                                         <x:Double>0.1</x:Double>
                                         <x:Double>2</x:Double>
                                     </DoubleCollection>
                                </map:MapLine.StrokeDashArray>
                             </map:MapLine>
                          </map:MapLineLayer.Lines>
                     </map:MapLineLayer>
                 </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"));
    MapLineLayer mapLineLayer = new MapLineLayer();
    MapLine line = new MapLine();
    line.From = new MapLatLng(26.841944, 114.561183);
    line.To = new MapLatLng(37.316207, 89.494558);
    line.StrokeThickness = 3;
    line.StrokeLineCap = LineCap.Round;
    line.Stroke = Brush.LightGreen;
    line.StrokeDashArray = new double[] { 2, 2, 0.1, 2 };
    mapLineLayer.Lines.Add(line);
    layer.Sublayers.Add(mapLineLayer);
    maps.Layer = layer;
    this.Content = maps;

    StrokeLineCap

    Gets or sets the value that specifies the shape of the line's start and end of a line.

    Declaration
    public LineCap StrokeLineCap { get; set; }
    Property Value
    Type Description
    Microsoft.Maui.Graphics.LineCap

    It specifies the stroke cap of the map line. The default value is butt.

    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:MapLineLayer>
                         <map:MapLineLayer.Lines>
                             <map:MapLine StrokeThickness = "3"
                                          StrokeLineCap="Round">
                                 <map:MapLine.From>
                                     <map:MapLatLng Latitude="26.841944"
                                                    Longitude="114.561183" />
                                 </map:MapLine.From>
                                  <map:MapLine.To>
                                     <map:MapLatLng Latitude="37.316207" 
                                                    Longitude="89.494558" />
                                 </map:MapLine.To>
                             </map:MapLine>
                          </map:MapLineLayer.Lines>
                     </map:MapLineLayer>
                 </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"));
    MapLineLayer mapLineLayer = new MapLineLayer();
    MapLine line = new MapLine();
    line.From = new MapLatLng(26.841944, 114.561183);
    line.To = new MapLatLng(37.316207, 89.494558);
    line.StrokeThickness = 3;
    line.StrokeLineCap = LineCap.Round;
    mapLineLayer.Lines.Add(line);
    layer.Sublayers.Add(mapLineLayer);
    maps.Layer = layer;
    this.Content = maps;

    StrokeThickness

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

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

    It specifies the width of the map line. The default value is 5.

    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:MapLineLayer>
                         <map:MapLineLayer.Lines>
                             <map:MapLine StrokeThickness = "3">
                                 <map:MapLine.From>
                                     <map:MapLatLng Latitude="26.841944"
                                                    Longitude="114.561183" />
                                 </map:MapLine.From>
                                  <map:MapLine.To>
                                     <map:MapLatLng Latitude="37.316207" 
                                                    Longitude="89.494558" />
                                 </map:MapLine.To>
                             </map:MapLine>
                          </map:MapLineLayer.Lines>
                     </map:MapLineLayer>
                 </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"));
    MapLineLayer mapLineLayer = new MapLineLayer();
    MapLine line = new MapLine();
    line.From = new MapLatLng(26.841944, 114.561183);
    line.To = new MapLatLng(37.316207, 89.494558);
    line.StrokeThickness = 3;
    mapLineLayer.Lines.Add(line);
    layer.Sublayers.Add(mapLineLayer);
    maps.Layer = layer;
    this.Content = maps;

    To

    Gets or sets the value that specifies the end point of line.

    Declaration
    public MapLatLng To { get; set; }
    Property Value
    Type Description
    MapLatLng

    The to value of the map line. The default is null.

    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:MapLineLayer>
                         <map:MapLineLayer.Lines>
                             <map:MapLine>
                                 <map:MapLine.From>
                                     <map:MapLatLng Latitude="26.841944"
                                                    Longitude="114.561183" />
                                 </map:MapLine.From>
                                  <map:MapLine.To>
                                     <map:MapLatLng Latitude="37.316207" 
                                                    Longitude="89.494558" />
                                 </map:MapLine.To>
                             </map:MapLine>
                          </map:MapLineLayer.Lines>
                     </map:MapLineLayer>
                 </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"));
    MapLineLayer mapLineLayer = new MapLineLayer();
    MapLine line = new MapLine();
    line.From = new MapLatLng(26.841944, 114.561183);
    line.To = new MapLatLng(37.316207, 89.494558);
    mapLineLayer.Lines.Add(line);
    layer.Sublayers.Add(mapLineLayer);
    maps.Layer = layer;
    this.Content = maps;
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved