This documentation is archived and is not being maintained.

LineSegment.Point Property

Gets or sets the end point of the line segment.

Namespace:  System.Windows.Media
Assembly:  PresentationCore (in PresentationCore.dll)
XMLNS for XAML: http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation

'Declaration
Public Property Point As Point
<object>
  <object.Point>
    <Point .../>
  </object.Point>
</object>
<object Point="Point" .../>

Property Value

Type: System.Windows.Point
The end point of the line segment.

Identifier field

PointProperty

Metadata properties set to true

None

The LineSegment class does not contain a property for the starting point of the line. The starting point of the line is the current point of the PathFigure object where you add the line.

This example shows how to create a line segment. To create a line segment, use the PathGeometry, PathFigure, and LineSegment classes.

The following examples draw a LineSegment from (10, 50) to (200, 70). The following illustration shows the resulting LineSegment; a grid background was added to show the coordinate system.

A LineSegment drawn from (10,50) to (200,700)

A LineSegment in a PathFigure

[xaml]

In Extensible Application Markup Language (XAML), you may use attribute syntax to describe a path.


<Path Stroke="Black" StrokeThickness="1"  
  Data="M 10,50 L 200,70" />


[xaml]

(Note that this attribute syntax actually creates a StreamGeometry, a lighter-weight version of a PathGeometry. For more information, see the Path Markup Syntax page.)

In XAML, you may also draw a line segment by using object element syntax. The following is equivalent to the previous XAML example.


			Dim myPathFigure As New PathFigure()
			myPathFigure.StartPoint = New Point(10, 50)

			Dim myLineSegment As New LineSegment()
			myLineSegment.Point = New Point(200, 70)

			Dim myPathSegmentCollection As New PathSegmentCollection()
			myPathSegmentCollection.Add(myLineSegment)

			myPathFigure.Segments = myPathSegmentCollection

			Dim myPathFigureCollection As New PathFigureCollection()
			myPathFigureCollection.Add(myPathFigure)

			Dim myPathGeometry As New PathGeometry()
			myPathGeometry.Figures = myPathFigureCollection

			Dim myPath As New Path()
			myPath.Stroke = Brushes.Black
			myPath.StrokeThickness = 1
			myPath.Data = myPathGeometry



<Path Stroke="Black" StrokeThickness="1">
  <Path.Data>
    <PathGeometry>
      <PathFigure StartPoint="10,50">
        <LineSegment Point="200,70" />
      </PathFigure>
    </PathGeometry>
  </Path.Data>
</Path>


This example is part of larger sample; for the complete sample, see the Geometries Sample.

.NET Framework

Supported in: 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Show: