Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

LineGeometry Object

Represents the geometry of a line.

XAML
<LineGeometry .../>
Scripting
To create an object using scripting, see CreateFromXAML.

Remarks

FillRule is technically a property inherited from the base Geometry class, but setting it has no effect on a LineGeometry.

Examples

The following example shows how to create and render a LineGeometry. A Geometry object only defines the geometry of the object, it does not render anything directly, so the example uses a Path shape to render the line. Because a line has no area, setting the Fill property of the Path would have no effect; instead, only the Stroke and StrokeThickness properties are specified. The following illustration shows the output from the example.

A LineGeometry drawn from (10,20) to (100,130)

A LineGeometry drawn from (10,20) to (100,130)

XAML
<Canvas  
  xmlns="http://schemas.microsoft.com/client/2007"  
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  Width="200" Height="200"> 
  <Path Stroke="Black" StrokeThickness="1" >
    <Path.Data>
      <LineGeometry StartPoint="10,20" EndPoint="100,130" />
    </Path.Data>
  </Path> 
</Canvas>

See Also

Geometry Overview
Geometry
GeometryGroup

Community Additions

Show:
© 2015 Microsoft