Freigeben über


PolyQuadraticBezierSegment.Points Property

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

Gets or sets the PointCollection that defines this PolyQuadraticBezierSegment object.

Namespace:  System.Windows.Media
Assembly:  System.Windows (in System.Windows.dll)

Syntax

'Declaration
Public Property Points As PointCollection
public PointCollection Points { get; set; }
<PolyQuadraticBezierSegment Points="pointSet"/>

XAML Values

  • pointSet
    See "pointSet Grammar" in Remarks.

Property Value

Type: System.Windows.Media.PointCollection
A collection of points that defines the shape of this PolyQuadraticBezierSegment object. The default value is an empty collection.

Remarks

Dependency property identifier field: PointsProperty

In XAML, a set of points is defined through a string syntax, enabled by an underlying type converter on the PointCollection type of the collection. Although various "Points" properties share the PointCollection property type, different properties expect different numbers of points in the collection. Points expects a minimum of two points, and can also take an unlimited total number of points, as long as the point count is divisible by two. See the "XAML Values" section for the description of the pointSet attribute syntax for Points.

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. If you are specifying only two points (a single quadratic Bezier curve) you could instead use QuadraticBezierSegment and set the Point1 and Point2 values.

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 point set must be divisible by two, 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.

pointSet Grammar

A valid pointSet for the Points property must describe a number of points that is divisible by two.

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 not allowed and will cause either a parser or runtime error.

Examples

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

Run this sample

<Canvas>
  <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>

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.