Provides a base class for objects that define geometric shapes. Geometry objects can be used for clipping regions and as geometry definitions for rendering two-dimensional graphical data as a Path.
The Geometry class has these types of members:
The Geometry class has these methods. It also inherits methods from the Object class.
|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)|
The Geometry class has these properties.
|Read-only||Gets a Rect that specifies the axis-aligned bounding box of the Geometry.|
|Read-only||Gets the CoreDispatcher that this object is associated with. (Inherited from DependencyObject)|
|Read-only||Gets an empty geometry object.|
|Read-only||Gets the standard tolerance used for polygonal approximation.|
|Read/write||Gets or sets the Transform object applied to a Geometry.|
|Read-only||Identifies the Transform dependency property.|
For properties that take a Geometry, you need to specify a nonabstract derived type of Geometry, as an object element for XAML, or as a defined instance for code. For details, see reference pages for EllipseGeometry, GeometryGroup, LineGeometry, PathGeometry, or RectangleGeometry.
Geometries can be conceptualized as being "simple" or "complex". EllipseGeometry, LineGeometry, and RectangleGeometry are the simple geometries, which specify the geometrical shape as one element with basic coordinate or dimension properties. GeometryGroup and PathGeometry are the complex geometries. GeometryGroup combines other geometries that it holds as child objects. PathGeometry uses either a set of nested figure/segment path definition elements, or a compact string syntax that's usually output by designers, to describe a complex path for the geometry.
A Geometry does not entirely define its own rendering, in that it's not a UIElement itself and needs to be provided as some property value for a UIElement in order to cause a rendering effect. Typically, a Geometry is provided as data for a Path (which is a kind of Shape).
The Shape class has a Fill, Stroke, and other rendering properties that Geometry and its derived classes lack. The Shape class is a FrameworkElement and therefore participates in the layout system; its derived classes can be used as the content of any element that supports UIElement children. The Geometry class, on the other hand, simply defines the geometry as a graphics primitive, and cannot render itself. You could conceivably use Geometry as a property type for custom UI element properties where the basic graphics primitive expressions enabled by Geometry are useful as a definition.
To provide a value for the UIElement.Clip property in the Windows Runtime, you must specifically use a RectangleGeometry, not any Geometry derived type. If you're porting XAML or code from other XAML frameworks, see if you can change your UIElement.Clip to use RectangleGeometry. Otherwise, you might need to change the Z-order relationship and use techniques such as an overlay of an ImageBrush with a modified RenderTargetBitmap source that has alpha transparency for the "clipping" parts.
Geometry is the parent class for several derived classes that define different categories of practical geometries:
- GeometryGroup - can be used to specify multiple geometries as Children
- PathGeometry - use this type for any geometry that can't be expressed by the other "simple" geometry types
Minimum supported client
|Windows 8 [Windows Store apps only]|
Minimum supported server
|Windows Server 2012 [Windows Store apps only]|
- Quickstart: Drawing shapes
Build date: 11/16/2013