PathFigure class

Applies to Windows and Windows Phone

Represents a subsection of a geometry, a single connected series of two-dimensional geometric segments.

Inheritance

Object
  DependencyObject
    PathFigure

Syntax


public sealed class PathFigure : DependencyObject


<PathFigure .../>
-or-
<PathFigure ...>
  oneOrMorePathSegments
</PathFigure

XAML Values

oneOrMorePathSegments

One or more object elements that derive from PathSegment. Typically these are ArcSegment, BezierSegment, LineSegment, PolyBezierSegment, PolyQuadraticBezierSegment, or QuadraticBezierSegment. Object elements defined here become members of the collection when code accesses the Segments property at run time.

Attributes

[ContentProperty("Name=Segments")]
[MarshalingBehavior(Agile)]
[Threading(Both)]
[Version(0x06020000)]
[WebHostHidden()]

Members

The PathFigure class has these types of members:

Constructors

The PathFigure class has these constructors.

ConstructorDescription
PathFigure Initializes a new instance of the PathFigure class.

 

Methods

The PathFigure class has these methods. It also inherits methods from the Object class.

MethodDescription
ClearValue Clears the local value of a dependency property. (Inherited from DependencyObject)
GetAnimationBaseValue Returns any base value established for a dependency property, which would apply in cases where an animation is not active. (Inherited from DependencyObject)
GetValue Returns the current effective value of a dependency property from a DependencyObject. (Inherited from DependencyObject)
ReadLocalValue Returns the local value of a dependency property, if a local value is set. (Inherited from DependencyObject)
SetValue Sets the local value of a dependency property on a DependencyObject. (Inherited from DependencyObject)

 

Properties

The PathFigure class has these properties.

PropertyAccess typeDescription

Dispatcher

Read-onlyGets the CoreDispatcher that this object is associated with. (Inherited from DependencyObject)

IsClosed

Read/writeGets or sets a value that indicates whether this figure's first and last segments are connected.

IsClosedProperty

Read-onlyIdentifies the IsClosed dependency property.

IsFilled

Read/writeGets or sets a value that indicates whether the contained area of this PathFigure is to be used for hit-testing, rendering, and clipping.

IsFilledProperty

Read-onlyIdentifies the IsFilled dependency property.

Segments

Read/writeGets or sets the collection of segments that define the shape of this PathFigure object.

SegmentsProperty

Read-onlyIdentifies the Segments dependency property.

StartPoint

Read/writeGets or sets the Point where the PathFigure begins.

StartPointProperty

Read-onlyIdentifies the StartPoint dependency property.

 

Remarks

PathFigureCollection is a strongly typed collection for PathFigure items. PathFigureCollection is the type used by the PathGeometry.Figures property. In XAML, specify one or more PathFigure elements for this property.

This class is relevant for setting the vector data for either a Path or a PathIcon.

Rather than creating an instance or an object element, you can also define segments and a single PathFigure as part of a vector within the string for a Move and draw commands syntax.

Examples

This 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).


<Canvas>
    <Path Stroke="Black" StrokeThickness="4">
        <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.


<Canvas>
    <Path Stroke="Black" StrokeThickness="4" >
        <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>


A PathGeometry with curves

Requirements

Minimum supported client

Windows 8 [Windows Store apps only]

Minimum supported server

Windows Server 2012 [Windows Store apps only]

Minimum supported phone

Windows Phone 8.1 [Windows Runtime apps only]

Namespace

Windows.UI.Xaml.Media
Windows::UI::Xaml::Media [C++]

Metadata

Windows.winmd

See also

DependencyObject
PathGeometry
PathSegment
PathFigureCollection
XAML vector-based drawing sample
Quickstart: Drawing shapes
Move and draw commands syntax

 

 

Show:
© 2014 Microsoft