Share via


Points (Polygon)

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Sets the vertex points of a polygon.

<object Points="pointSet"  .../>
object.Points = "pointSet"

Property Value

Type: string

A delimited string that represents the set of points that define the vertex points of the polygon.

This property is write-only.

pointSet Grammar

X,Y[,X*,Y*]*

X, Y

A pair of double values that identifies the initial point of the polygon.

X*,Y*

Subsequent pairs of double values that define additional points of this object.

  • The [] (bracket) characters are not literals; they indicate optional values. The asterisk (*) indicates that any number of points is permitted after the initial X,Y.

  • The separator in this grammar can be either a space or a comma. You can use a mixture of spaces and commas 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 is illegal and will raise either a parser or a run-time error. The number of double values in the string must always be even so that it is evaluated as x,y pairs of points.

Managed Equivalent

Points

Remarks

A set of points is defined through a string syntax, which is enabled by an underlying type converter. There is no object available in the object model for accessing the set of points as a collection. In either script or XAML, Points is write-only; attempting to get the value in script will result in a run-time GetValue error. You set the value by specifying a string. Without a collection object, there is no way to obtain a count in the object model. However, you could parse the string yourself and count separators, or otherwise get a count before you pass the string as input.

As an example of the pointSet grammar, the string "0,0,100,0,0,100" would produce a right triangle with its right angle placed at 0,0.

A single point, such as (0,0), is a valid value, but it will not render anything because you need a minimum of two points to produce rendered output.

Applies To

Polygon