LineSegment Object

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

XAML
<LineSegment .../>
Scripting
To create an object using scripting, see the CreateFromXAML method.

Properties

Name, Point

Methods

Equals, FindName, GetHost, GetValue, SetValue

Remarks

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

Examples

The following example creates a simple PathGeometry made up of a single PathFigure with a LineSegment and displays it using a Path element. The PathFigure object's StartPoint 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 that contains a single LineSegment

A LineGeometry

XAML
<Canvas  
  xmlns="http://schemas.microsoft.com/client/2007" 
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> 
  
  <Path Stroke="Black" StrokeThickness="1">
    <Path.Data>
      <PathGeometry>
        <PathGeometry.Figures>
          <PathFigure StartPoint="10,20">
            <PathFigure.Segments>
              <LineSegment Point="100,130"/>
            </PathFigure.Segments>
          </PathFigure>
        </PathGeometry.Figures>
      </PathGeometry>
    </Path.Data>
  </Path> 
</Canvas>

See Also

Silverlight Geometries Overview

Community Additions

Show: