Represents a complex shape that may be composed of arcs, curves, ellipses, lines, and rectangles.
Assembly: PresentationCore (in PresentationCore.dll)
XMLNS for XAML: http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation
Each 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.
In Extensible Application Markup Language (XAML), you may use attribute syntax to describe a path.
In XAML, you may also draw a line segment by using object element syntax. The following is equivalent to the previous XAML example.
PathFigure myPathFigure = new PathFigure(); myPathFigure.StartPoint = new Point(10, 50); LineSegment myLineSegment = new LineSegment(); myLineSegment.Point = new Point(200, 70); PathSegmentCollection myPathSegmentCollection = new PathSegmentCollection(); myPathSegmentCollection.Add(myLineSegment); myPathFigure.Segments = myPathSegmentCollection; PathFigureCollection myPathFigureCollection = new PathFigureCollection(); myPathFigureCollection.Add(myPathFigure); PathGeometry myPathGeometry = new PathGeometry(); myPathGeometry.Figures = myPathFigureCollection; Path myPath = new Path(); myPath.Stroke = Brushes.Black; myPath.StrokeThickness = 1; myPath.Data = myPathGeometry;
This example is part of larger sample; for the complete sample, see the Geometries Sample.
|How to: Create an Elliptical Arc||This example shows how to draw an elliptical arc. To create an elliptical arc, use the , PathFigure, and ArcSegment classes.|
|How to: Create a Cubic Bezier Curve||This example shows how to create a cubic Bezier curve. To create a cubic Bezier curve, use the , PathFigure, and BezierSegment classes. To display the resulting geometry, use a Path element, or use it with a GeometryDrawing or a DrawingContext. In the following examples, a cubic Bezier curve is drawn from (10, 100) to (300, 100). The curve has control points of (100, 0) and (200, 200).|
|How to: Create a Quadratic Bezier Curve||This example shows how to create a quadratic Bezier curve. To create a quadratic Bezier curve, use the , PathFigure, and QuadraticBezierSegment classes.|
|How to: Create a Composite Shape||This example shows how to create composite shapes using Geometry objects and display them using a Path element. In the following example, a LineGeometry, EllipseGeometry, and a RectangleGeometry are used with a GeometryGroup to create a composite shape. The geometries are then drawn using a Path element.|
|How to: Create Multiple Subpaths Within a PathGeometry||This example shows how to create multiple subpaths in a . To create multiple subpaths, you create a PathFigure for each subpath.|
|How to: Control the Fill of a Composite Shape||The FillRule property of a GeometryGroup or a , specifies a "rule" which the composite shape uses to determine whether a given point is part of the geometry. There are two possible values for FillRule: EvenOdd and Nonzero. The following sections will describe how to use these two rules.|
Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.