Points Property (PolyQuadraticBezierSegment)

Gets or sets the set of points that defines this PolyQuadraticBezierSegment object.

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

Property Value

string

The set of points that defines this PolyQuadraticBezierSegment 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[, X1*,Y1*,X2*,Y2*]*
X1, Y1 A pair of double values that identify the x,y control point of the first segment.
X2, Y2 A pair of double values that identify the x,y end point "B" of the first segment.
X1*, Y1* Subsequent pairs of double values that identify the control points of more segments defined by this object.
X2*, Y2*, etc. Subsequent pairs of double values that identify the 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 four doubles (two points) that define more segments is permitted past the initial X1,Y1,X2,Y2.
  • 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.

Remarks

The first two points in the collection specify the control point and end point of the first curve segment. The next two points specify the control point and end point of the second curve segment, and so on. The collection should contain an even number of points.

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 the control point. You need a minimum of two points to produce a rendered output for a PolyQuadraticBezierSegment. In order to render, the number of points in the pointset must be divisible by 2 so that there is always one control point 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 creates two curves using a PolyQuadraticBezierSegment to specify the coordinates.

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 PolyQuadraticBezierSegment specifies two Bezier curves.
                           The first curve is from 10,100 (start point specified above)
                           to 300,100 with a control point of 200,200. The second curve
                           is from 200,200 (end of the last curve) to 30,400 with a 
                           control point of 0,200. -->
                      <PolyQuadraticBezierSegment Points="200,200 300,100 0,200 30,400" />
                    </PathSegmentCollection>
                  </PathFigure.Segments>
                </PathFigure>
              </PathFigureCollection>
            </PathGeometry.Figures>
          </PathGeometry>
        </Path.Data>
      </Path>
</Canvas>

Applies To

PolyQuadraticBezierSegment

See Also

Silverlight Geometries Overview

Community Additions

Show: