Points Property (PolyBezierSegment)

Gets or sets the set of points that define this PolyBezierSegment object.

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

Property Value

string

The set of points that define this PolyBezierSegment object, as a delimited string that represents a point set. See pointSet Grammar section.

This property is write-only.

pointSet Grammar

X1,Y1,X2,Y2,X3,Y3[, X1*,Y1*,X2*,Y2*,X3*,Y3*]*
X1, Y1 A pair of double values that identify the x,y first control point of the first segment.
X2, Y2 A pair of double values that identify the x,y second control point of the first segment.
X3, Y3 A pair of double values that identify the x,y end point of the first segment.
[, X1*,Y1*,X2*,Y2*,X3*,Y3*]* Subsequent pairs of double values that identify the first and second control points and end points of more segments defined by this object.
  • The [] characters are not literals, they are indicators of optional values. The * indicates that any number of the sequence of six doubles (three points) that define more segments is permitted past the initial X1,Y1,X2,Y2,X3,Y3.
  • 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 that define a point.

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.

  • A single point, is accepted by the type converter, but will not render anything because you have thus far defined only one control point. You need a minimum of three points to produce a rendered output for a PolyBezierSegment. In order to render, the number of points in the pointset must be divisible by 3 so that there are always two control points and one end point for each segment. The behavior is that no segments render, rather than assuming that only the last segment is missing information and therefore other segments could render.
  • Examples

    The following example shows how to use a PolyBezierSegment to create a series of curves.

    XAML
    <Canvas
      xmlns="http://schemas.microsoft.com/client/2007"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      Width="500" Height="100">
          <Path Stroke="Black" StrokeThickness="1">
            <Path.Data>
              <PathGeometry>
                <PathGeometry.Figures>
                  <PathFigureCollection>
    
                    <!-- The StartPoint specifies the starting point of the first curve. -->
                    <PathFigure StartPoint="10,100">
                      <PathFigure.Segments>
                        <PathSegmentCollection>
    
                          <!-- The PolyBezierSegment specifies two cubic Bezier curves.
                               The first curve is from 10,100 (start point specified above)
                               to 300,100 with a control point of 0,0 and another control
                               point of 200,0. The second curve is from 300,100 
                               (end of the last curve) to 600,100 with a control point of 300,0
                               and another control point of 400,0. -->
                          <PolyBezierSegment Points="0,0 200,0 300,100 300,0 400,0 600,100" />
                        </PathSegmentCollection>
                      </PathFigure.Segments>
                    </PathFigure>
                  </PathFigureCollection>
                </PathGeometry.Figures>
              </PathGeometry>
            </Path.Data>
          </Path>
    </Canvas>
    

    Applies To

    PolyBezierSegment

    See Also

    Silverlight Geometries Overview
    Path Markup Syntax

    Community Additions

    Show: