* Reset branch for WPF changes * Convert BMP to PNG; fix link-out-of-scope err * Add snippets for WPF... 6794 files!!!! * Add missing snippets * update file updated between migration * Fix paths to include * update breadcrumb and toc * fix index links * fix index links * fix index links * fix markdown
2.3 KiB
title, ms.date, helpviewer_keywords, ms.assetid
| title | ms.date | helpviewer_keywords | ms.assetid | ||
|---|---|---|---|---|---|
| How to: Create a Shape by Using a PathGeometry | 03/30/2017 |
|
49a4a8b7-e738-45be-8dac-b54a6d8f5b21 |
How to: Create a Shape by Using a PathGeometry
This example shows how to create a shape using the xref:System.Windows.Media.PathGeometry class. xref:System.Windows.Media.PathGeometry objects are composed of one or more xref:System.Windows.Media.PathFigure objects; each xref:System.Windows.Media.PathFigure represents a different "figure" or shape. Each xref:System.Windows.Media.PathFigure is itself composed of one or more xref:System.Windows.Media.PathSegment objects, each representing a connected portion of the figure or shape. Segment types include xref:System.Windows.Media.LineSegment, xref:System.Windows.Media.ArcSegment, and xref:System.Windows.Media.BezierSegment.
Example
The following example uses a xref:System.Windows.Media.PathGeometry to create a triangle. The xref:System.Windows.Media.PathGeometry is displayed using a xref:System.Windows.Shapes.Path element.
[!code-xamlGeometrySample#49]
The following illustration shows the shape created in the previous example.

A triangle created with a PathGeometry
The previous example showed how to create a relatively simple shape, a triangle. A xref:System.Windows.Media.PathGeometry can also be used to create more complex shapes, including arcs and curves. For examples, see Create an Elliptical Arc, Create a Cubic Bezier Curve, and Create a Quadratic Bezier Curve.
This example is part of larger sample; for the complete sample, see the Geometries Sample.