Microsoft Silverlight will reach end of support after October 2021. Learn more.

Represents a line drawn between two points, which can be part of a PathFigure object in Path data.

<LineSegment   .../>

Managed Equivalent



LineSegment is the simplest segment type. The start of the line is either the start point or the last point of the previous segment.

You can also generate the simple shape of a line by using the Line object. LineSegment is particularly intended for drawing a line in what is typically a more complex geometry group.


The following example creates a simple PathGeometry object composed of a single PathFigure object with a LineSegment and displays it by using a Path element. The PathFigure object's StartPoint property is set to 10,20 and a LineSegment is defined with an end point of 100,130. The following illustration shows the PathGeometry created by this example.

A PathGeometry

Diagonal line.

  <Path Stroke="Black" StrokeThickness="1">
          <PathFigure StartPoint="10,20">
              <LineSegment Point="100,130"/>