Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

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:  http://schemas.microsoft.com/winfx/2006/xaml/presentation

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();
myPointCollection2.Add(Point4);
myPointCollection2.Add(Point5);
myPointCollection2.Add(Point6);
myPolyline.Points = myPointCollection2;
myGrid.Children.Add(myPolyline);

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.

System.Object
   System.Windows.Threading.DispatcherObject
     System.Windows.DependencyObject
       System.Windows.Media.Visual
         System.Windows.UIElement
           System.Windows.FrameworkElement
             System.Windows.Shapes.Shape
              System.Windows.Shapes.Polyline

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
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

Show:
© 2014 Microsoft