RadPathGeometry

In order to create a specific RadPath, you need to set a RadPathGeometry object to its Geometry property. The RadPathGeometry object exposes a Figures property which is a collection of RadPathFigures.

RadPathFigure

Each of the RadPathFigure objects is composed of one or several segments. These can be a RadArcSegment or a RadLineSegment. Adding several segments in combination with setting up the StartPoint of the RadPathFigure is enough for you to create the desired figure which should be added to the figures collection of the geometry.

RadArcSegment

The RadArcSegment represents an elliptical arc between two points. It exposes the following properties:

  • Center: The center point of the arc.
  • Size: Gets or sets the x- and y-radius of the arc as a Size structure.
  • StartAngle: The Angle from which the arc segment will start.
  • SweepAngle: The Value

Here is a sample implementation of an RadArcSegment object:

RadLineSegment

Creates a line between two points in a RadPathFigure. It exposes a single Point property which is used to get/set the end point of the segment.

RadPathFigure line = new RadPathFigure();
line.StartPoint = new Point(0.8, 0.1);
line.Segments.Add(new RadLineSegment(new Point(0.1, 0.8)));

Example

The following example shows how to create a RadPathGeometry object and add a line with curved edges to its Figures collection.

First you should define the RadPath figure:

<telerikPrimitives:RadPath x:Name="customLine"
                       Grid.Row="0"
                       StrokeThickness="0" 
                       Fill="#3DBAFE"/>

And then you set its Geometry to have the following structure:

internal RadPathGeometry CreateLineGeometry()
{
    RadPathFigure line = new RadPathFigure();
    line.StartPoint = new Point(0.8, 0.1);
    line.Segments.Add(new RadLineSegment(new Point(0.1, 0.8)));
    line.Segments.Add(new RadArcSegment() { Center = new Point(0.125, 0.825), StartAngle = 135, SweepAngle = 180, Size = new Size(0.070710678, 0.070710678) });
    line.Segments.Add(new RadLineSegment(new Point(0.85, 0.15)));
    line.Segments.Add(new RadArcSegment() { Center = new Point(0.825, 0.125), StartAngle = 315, SweepAngle = 180, Size = new Size(0.070710678, 0.070710678) });

    RadPathGeometry geometry = new RadPathGeometry();
    geometry.Figures.Add(line);

    return geometry;
}

See Also