共用方式為


Points (PolyLineSegment)

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

Sets the set of points that defines a PolyLineSegment object.

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

Property Value

Type: string

A delimited string that represents the set of points that define this PolyLineSegment object.

This property is write-only.

pointSet Grammar

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

X, Y

A pair of double values that identifies the endpoint of the first segment.

X*,Y*

Subsequent pairs of double values that define the endpoints of additional segments of this object.

  • The [] (bracket) characters are not literals; they indicate optional values. The asterisk (*) 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 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 that define a point.

Managed Equivalent

Points

Remarks

A line is drawn from the endpoint of the previous segment, or, if this is the first segment, from the StartPoint of the PathFigure to the first point in the set of points. Lines are then drawn between each subsequent point.

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, a StartPoint of 0,0 and the string "50,100,100,0" for PolyLineSegment.Points would produce a "V" shaped polyline segment with its acute angle placed at 50,100.

Applies To

PolyLineSegment