共用方式為


Geometry

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Provides a base class for objects that define geometric shapes. You can use geometry objects for clipping regions and as geometry definitions for rendering two-dimensional graphic data as a Path.

Syntax Notes

See Derived Objects for syntax information.

Managed Equivalent

Geometry

Remarks

For XAML syntaxes that take a Geometry object, you need to specify a non-abstract derived type of Geometry as an object element. For more information, see the XAML syntax on the reference pages for the EllipseGeometry, GeometryGroup, LineGeometry, PathGeometry, or RectangleGeometry objects.

Geometry is abstract and is not returned as that object type by any JavaScript APIs for Silverlight. You also cannot create a true Geometry in XAML. For this reason, Geometry is not listed in the "Applies To" lists for APIs that Geometry itself defines, because it is abstract and those APIs can be exercised only on a practical derived class.

Geometries can be conceptualized as simple or complex. EllipseGeometry, LineGeometry, and RectangleGeometry are simple geometries, which specify the geometric shape as one element with basic coordinate or dimension properties. GeometryGroup and PathGeometry are complex geometries. GeometryGroup combines other geometries that it holds as child objects. PathGeometry uses either a set of nested figure or segment path definition elements or a compact string syntax to describe a path for the geometry. A Geometry does not entirely define its own rendering. Instead, a Geometry is provided as data for a Path. Path in turn is a UIElement and, therefore, is part of the Silverlight rendering system.

For more information on basic concepts, see Geometries. Note that the Geometries topic is written primarily for users of the managed API, and may not have code examples or specific information that address the JavaScript API scenarios.