Compartir a través de


PolyBezierSegment.Points Property

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

Gets or sets the PointCollection that defines this PolyBezierSegment object.

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

Syntax

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

XAML Values

  • pointSet
    See "pointSet Grammar" in Remarks.

Property Value

Type: System.Windows.Media.PointCollection
The collection of points that defines this PolyBezierSegment object.

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 three points, and can also take an unlimited total number of points so long as the point count is divisible by three. See the "XAML Values" section for the description of the pointSet attribute syntax for Points.

A single point (X,Y pair) 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 point set must be divisible by 3, so that there are always two control points and one end point for each segment. The behavior if the point count is not divisible by three 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 three.

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 not allowed and will cause 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.

Examples

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

Run this sample

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

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.