Share via


Points Property (Polygon)

Gets or sets the vertex points of the polygon.

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

Property Value

string

The set of points that define the vertex points of the polygon, as a delimited string that represents a point set. See pointSet Grammar section.

This property is write-only.

pointSet Grammar

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 optional values. The * 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 illegal 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.

Remarks

A set of points is defined through a string syntax, 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 runtime GetValue error. You set the value by specifying a string. Without a collection object, there is no means in the object model to obtain a count, although 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 will not render anything because you need a minimum of two points to produce a rendered output.

Applies To

Polygon

See Also

Shapes and Drawing in Silverlight Overview