This documentation is archived and is not being maintained.

Polyline Class

Draws a series of connected straight lines. This class cannot be inherited.

Namespace: System.Windows.Shapes
Assembly: PresentationFramework (in presentationframework.dll)
XML Namespace:

public sealed class Polyline : Shape
public final class Polyline extends Shape
public final class Polyline extends Shape

This object is similar to the Polygon object, except that this object does not need to be a closed shape.

The following example shows how to create a Polyline element and set its properties by using code. For the complete sample, see Create Shape Elements Using Code Sample.

// Add the Polyline Element
myPolyline = new Polyline();
myPolyline.Stroke = Brushes.SlateGray;
myPolyline.StrokeThickness = 2;
myPolyline.FillRule = FillRule.EvenOdd;
Point Point4 = new Point(1, 50);
Point Point5 = new Point(10, 80);
Point Point6 = new Point(20, 40);
PointCollection myPointCollection2 = new PointCollection();
myPolyline.Points = myPointCollection2;

More Code

How to: Draw a Polyline by Using the Polyline Element

This example shows how to draw a polyline, which is a series of connected lines, by using the Polyline element.


Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0