Path.Data Property
Assembly: PresentationFramework (in presentationframework.dll)
XML Namespace: http://schemas.microsoft.com/winfx/2006/xaml/presentation
/** @property */ public Geometry get_Data () /** @property */ public void set_Data (Geometry value)
public function get Data () : Geometry public function set Data (value : Geometry)
<object Data="moveAndDrawCommands"/>
For XAML property element usage information, see the Geometry type.
moveAndDrawCommands One or more move and draw commands. For the complete syntax, see PathGeometry Markup Syntax.
Property Value
A description of the shape to be drawn.To draw simple shapes, use the EllipseGeometry, LineGeometry, and RectangleGeometry objects. To draw curves, arcs, or complex shapes, use the PathGeometry object. To create a composite geometry, use a GeometryGroup. To combine geometries, use a CombinedGeometry.
The following example shows how to create a Path element and set the Data property by using code. For the complete sample, see Create Shape Elements Using Code Sample.
//Add the Path Element myPath = new Path(); myPath.Stroke = Brushes.Black; myPath.Fill = Brushes.MediumSlateBlue; myPath.StrokeThickness = 4; myPath.HorizontalAlignment = HorizontalAlignment.Left; myPath.VerticalAlignment = VerticalAlignment.Center; EllipseGeometry myEllipseGeometry = new EllipseGeometry(); myEllipseGeometry.Center = new Point(50,50); myEllipseGeometry.RadiusX = 25; myEllipseGeometry.RadiusY = 25; myPath.Data = myEllipseGeometry; myGrid.Children.Add(myPath);
More Code
| 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 a Shape by Using a PathGeometry | This example shows how to create a shape using the PathGeometry class. PathGeometry objects are composed of one or more PathFigure objects; each PathFigure represents a different "figure" or shape. Each PathFigure is itself composed of one or more PathSegment objects, each representing a connected portion of the figure or shape. Segment types include LineSegment, ArcSegment, and BezierSegment. |
| How to: Animate an EllipseGeometry | This example shows how to animate a Geometry within a Path element. In the following example, a PointAnimation is used to animate the Center of an EllipseGeometry. |
| How to: Create a LineSegment in a PathGeometry | This example shows how to create a line segment. To create a line segment, use the PathGeometry, PathFigure, and LineSegment classes. |
| How to: Create an Elliptical Arc | This example shows how to draw an elliptical arc. To create an elliptical arc, use the PathGeometry, 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 PathGeometry, 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 PathGeometry, PathFigure, and QuadraticBezierSegment classes. |
Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.