How to: Create a LineSegment in a PathGeometry
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.
In Extensible Application Markup Language (XAML), you may use attribute syntax to describe a path.
In XAML, you may also draw a line segment by using object element syntax. The following is equivalent to the previous XAML example.
<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.