PathGeometry Object

Represents a complex shape that may be composed of arcs, curves, ellipses, lines, and rectangles.

XAML
<PathGeometry ...>
  oneOrMorePathFigures
</PathGeometry>
Scripting
To create an object using scripting, see CreateFromXAML.

XAML Values

oneOrMorePathFigures One or more PathFigure object elements. Object elements defined here become members of the collection held by the Figures property, when accessed by scripting at runtime.

Properties

Figures, FillRule, Name, Transform

Methods

Equals, FindName, GetHost, GetValue, SetValue

Remarks

Each PathGeometry object defines a collection of PathFigure objects. Each of the PathFigure objects is composed of one or more PathSegment objects, such as ArcSegment and LineSegment, which actually define their shape.

The filled area of the PathGeometry is defined by taking all of the contained PathFigure objects that have their IsFilled property set to true and applying the FillRule to determine the enclosed area.

Examples

The following example creates a simple PathGeometry made up of a single PathFigure with a LineSegment and displays it using a Path element. The PathFigure object's StartPoint is set to 10,20 and a LineSegment is defined with an end point of 100,130. The following illustration shows the PathGeometry created by this example.

A PathGeometry that contains a single LineSegment

A PathGeometry that contains a single LineSegment

XAML
<Canvas  
  xmlns="https://schemas.microsoft.com/client/2007" 
  xmlns:x="https://schemas.microsoft.com/winfx/2006/xaml"> 
  
  <Path Stroke="Black" StrokeThickness="1">
    <Path.Data>
      <PathGeometry>
        <PathGeometry.Figures>
          <PathFigure StartPoint="10,20">
            <PathFigure.Segments>
              <LineSegment Point="100,130"/>
            </PathFigure.Segments>
          </PathFigure>
        </PathGeometry.Figures>
      </PathGeometry>
    </Path.Data>
  </Path> 
</Canvas>

This example uses multiple segments in a PathFigure.

Multiple segments in a PathFigure

Multiple segments in a PathFigure

XAML
<Canvas  
  xmlns="https://schemas.microsoft.com/client/2007"  
  xmlns:x="https://schemas.microsoft.com/winfx/2006/xaml"> 
  
  <Path Stroke="Black" StrokeThickness="1" >
    <Path.Data>
      <PathGeometry>
        <PathGeometry.Figures>
          <PathFigure StartPoint="10,50">
            <PathFigure.Segments>
              <BezierSegment
                Point1="100,0"
                Point2="200,200"
                Point3="300,100"/>
              <LineSegment Point="400,100" />
              <ArcSegment
                Size="50,50" RotationAngle="45"
                IsLargeArc="True" SweepDirection="Clockwise"
                Point="200,100"/>
            </PathFigure.Segments>
          </PathFigure>
        </PathGeometry.Figures>
      </PathGeometry>
    </Path.Data>
  </Path> 
</Canvas>

See Also

Silverlight Geometry Overview
Path Markup Syntax
Geometry
GeometryGroup