Share via

Path Object

Draws a series of connected lines and curves. The line and curve dimensions are declared through the Data property, and can be specified either with a Path-specific mini-language, or with an object model.

<Path .../>
To create an object using scripting, see CreateFromXAML.


Canvas.Left, Canvas.Top, Canvas.ZIndex, Clip, Cursor, Data, Fill, Height, Name, Opacity, OpacityMask, RenderTransform, RenderTransformOrigin, Resources, Stretch, Stroke, StrokeDashArray, StrokeDashCap, StrokeDashOffset, StrokeEndLineCap, StrokeLineJoin, StrokeMiterLimit, StrokeStartLineCap, StrokeThickness, Tag, Triggers, Width


AddEventListener, CaptureMouse, Equals, FindName, GetHost, GetParent, GetValue, ReleaseMouseCapture, RemoveEventListener, SetValue


Loaded, MouseEnter, MouseLeave, MouseLeftButtonDown, MouseLeftButtonUp, MouseMove


Fundamentally, a Path is a Shape. But the Path can be used to create much more complex 2-D graphics than the other Shapes are capable of. The Path object can draw closed or open shapes, lines, and curves. See the Data property for a description of the shapes that the Path element supports.

A Path supports two parallel techniques for declaring its contents: as an object model using discrete geometries declared in markup or code, or as a mini-language declared in markup. The geometry object model can use the GeometryGroup as data in order to specify a composite of multiple geometries. For details, see Silverlight Geometries Overview. The mini-language is analogous to a pathing language output used in some graphics tools. For more information on using the mini-language definition format for Path in markup, see Path Markup Syntax.

Performance Note:   For best performance, avoid explicitly setting the Width and Height of a Path. Setting the Width and Height will result in additional stretching, which has a performance cost. Instead, rely on the explicitly set coordinates of the Path and its contained data to control its shape and position. In effect, the Path will have a natural height/width, although those values are not reported to the object model. See Stretch.


The following example uses a Path to draw an ellipse.

An EllipseGeometry drawn at (50,50)

An EllipseGeometry drawn at (50,50)

  <Path Fill="Gold" Stroke="Black" StrokeThickness="1">
      <EllipseGeometry Center="50,50" RadiusX="50" RadiusY="50" />

See Also

Path Markup Syntax
Shapes Overview
Silverlight Geometries Overview