Compartir a través de


Points (PolyQuadraticBezierSegment)

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

Sets the set of points that defines a PolyQuadraticBezierSegment object.

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

Property Value

Type: string

A delimited string that represents the set of points that defines the PolyQuadraticBezierSegment object.

This property is write-only.

pointSet Grammar

X1,Y1,X2,Y2[, X1*,Y1*,X2*,Y2*]*

X1, Y1

A pair of double values that identifies the control point of the first segment.

X2, Y2

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

X1*, Y1*

Subsequent pairs of double values that identify the control points of additional segments defined by this object.

X2*, Y2*, etc.

Subsequent pairs of double values that identify the endpoints of more segments defined by this object.

  • The [] (bracket) characters are not literals; they indicate optional values. The asterisk (*) indicates that any number of the sequence of four doubles (two points) that define more segments is permitted after 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 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.

Managed Equivalent

Points

Remarks

The first two points in the collection specify the control point and endpoint of the first curve segment. The next two points specify the control point and endpoint 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, 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.

A single point is accepted by the type converter, but it will not render anything because it defines only the control point. You need a minimum of two points to produce rendered output for a PolyQuadraticBezierSegment. To render, the number of points in the point set must be divisible by 2 so that there is always one control point and one endpoint for each segment. If this is not the case, no segments render.

Example

The following example creates two curves by using a PolyQuadraticBezierSegment to specify the coordinates.

<Canvas
  xmlns="https://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="https://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>