Polygon.Points Property
Microsoft Silverlight will reach end of support after October 2021. Learn more.
Gets or sets a collection that contains the vertex points of the polygon.
Namespace: System.Windows.Shapes
Assembly: System.Windows (in System.Windows.dll)
Syntax
'Declaration
Public Property Points As PointCollection
public PointCollection Points { get; set; }
<Polygon Points="pointSet"/>
XAML Values
- pointSet
See "pointSet Grammar" in Remarks.
Property Value
Type: System.Windows.Media.PointCollection
A collection of Point structures that describes the vertex points of the polygon. The default is nulla null reference (Nothing in Visual Basic). The value can be expressed as a string as described in "pointSet Grammar" below.
Remarks
Dependency property identifier field: PointsProperty
A single point specified as Points for a Polygon, such as (0,0), is a valid value as far as parsing and the object model, but it will not render anything because you need a minimum of two points to produce a rendered output.
Two points will render, but you could also have used a Line for this same result.
pointSet Grammar
A valid pointSet for the Points property describes one or more points. As an example of the points grammar, the string "0,0,100,0,0,100" would produce a right triangle with its right angle placed at 0,0.
X,Y[ X*,Y*]*
X, Y |
A pair of double values that identify the x,y initial point of the polygon. |
X*,Y* |
Subsequent pairs of double values that define additional points of this object. |
The [] characters are not literals; they are indicators of unbounded values. The * also is not literal and indicates that any number of points is permitted past the initial X,Y.
The separator in this grammar can be either a space or a comma. You can use a mixture of space and comma as separators. The common convention is to use commas between the X and Y, and spaces between the points.
Any odd number of double values in a Points value / set of points is not allowed and will throw either a parser or runtime error. The number of double values in the string must always be even so that it evaluates as x,y pairs of points.
The pointSet grammar behavior is implemented by a dedicated native-XAML type converter for PointCollection.
Version Information
Silverlight
Supported in: 5, 4, 3
Silverlight for Windows Phone
Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0
Platforms
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.
See Also