PathFigure Object
Represents a subsection of a geometry, a single connected series of two-dimensional geometric segments.
XAML | |
Scripting |
To create an object using scripting, see CreateFromXAML.
|
XAML Values
oneOrMorePathSegments | One or more object elements that derive from PathSegment. These can be one or more of the following: ArcSegment, BezierSegment, LineSegment, PolyBezierSegment, PolyQuadraticBezierSegment, QuadraticBezierSegment. Object elements defined here become members of the collection held by the Segments property, when accessed by scripting at runtime. |
Properties
IsClosed, Name, Segments, StartPoint
Methods
Equals, FindName, GetHost, GetValue, SetValue
Remarks
The defining property of a PathFigure is its StartPoint, because it specifies the point from which the first contained line segment starts.
If you want a geometry where various figures are not connected to one another, you would specify multiple PathFigure objects within the PathFigureCollection, each with different StartPoint values.
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
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
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 Geometries Overview
Path Markup Syntax
PathGeometry
PathSegment