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.
This topic has not yet been rated - Rate this topic

Polyline.Points Property

Gets or sets a collection that contains the vertex points of the Polyline. This is a dependency property.

Namespace:  System.Windows.Shapes
Assembly:  PresentationFramework (in PresentationFramework.dll)
XMLNS for XAML: http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation
public PointCollection Points { get; set; }
<object>
  <object.Points>
    <PointCollection .../>
  </object.Points>
</object>
<object Points="PointCollection" .../>

Property Value

Type: System.Windows.Media.PointCollection
A collection of Point structures that describe the vertex points of the Polyline. The default is a null reference (Nothing in Visual Basic).

Identifier field

PointsProperty

Metadata properties set to true

AffectsRender, AffectsMeasure

In Extensible Application Markup Language (XAML), use a space-delimited list of comma-separated x- coordinate and y-coordinate pairs to set this attribute. Use simple notation, that is, x1,y1 x2,y2 ... xn,yn.

The following example shows how to create a Polyline element and set the Points property by using code. For the complete sample, see WPF Shapes Gallery Sample.

// Add the Polyline Element
myPolyline = new Polyline();
myPolyline.Stroke = System.Windows.Media.Brushes.SlateGray;
myPolyline.StrokeThickness = 2;
myPolyline.FillRule = FillRule.EvenOdd;
System.Windows.Point Point4 = new System.Windows.Point(1, 50);
System.Windows.Point Point5 = new System.Windows.Point(10, 80);
System.Windows.Point Point6 = new System.Windows.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.

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

Show:
© 2014 Microsoft. All rights reserved.