Line

A Line is a control for drawing a line using a start and end point.


        <StackLayout Background="Gray"
            WidthRequest="200"
            HeightRequest="200"
            HorizontalOptions="Center"
            VerticalOptions="Center">
            <Line X1="10"
                  Y1="10"
                  X2="190"
                  Y2="190"
                  Stroke="Blue"
                  StrokeLineCap="Round"
                  StrokeThickness="5" />
        </StackLayout>                    
                

A StrokeLineCap defines the shape at the start and end of the line path. It can be Round, Square, or Flat (Default).

  • Flat represents a cap that does not extend past the last point of the line.
  • Square represents a rectangle that has a height equal to the line thickness and a length equal to half the line thickness.
  • Round represents a semicircle that has a diameter equal to the line thickness.

StrokeDashOffset is the distance between one dash line ending to second-line starting

StrokeDashArray="1,1"

StrokeDashArray represents a collection of double values showing the line and space patterns used to constrain the shape.

StrokeDashOffset="6"

StrokeThickness is the width of the shape outline

StrokeThickness="12"

Download

.NET MAUI