Share via


GeometryGroup Object

Represents a composite geometry, composed of other Geometry objects.

XAML
<GeometryGroup ...>
  oneOrMoreGeometries
</GeometryGroup>
Scripting
To create an object using scripting, see CreateFromXAML.

XAML Values

oneOrMoreGeometries One or more object elements that derive from Geometry. These can be one or more of the following: EllipseGeometry, GeometryGroup, LineGeometry, PathGeometry, RectangleGeometry. Object elements defined here become members of the collection held by the Children property, when accessed by scripting at runtime.

Properties

Children, FillRule, Name, Transform

Methods

Equals, FindName, GetHost, GetValue, SetValue

Remarks

FillRule is relevant for a GeometryGroup because the combined geometry can potentially have segment combinations where the application of a fill rule will have an effect.

In XAML usages, GeometryGroup uses Children as its content property and supports implicit collection usage. Therefore, to declare transforms that will be in a GeometryGroup in XAML, you declare one or more geometries as object elements, placing them in order as the child elements of the GeometryGroup. Nesting GeometryGroups is permitted.

Examples

Composite geometry objects can be created using a GeometryGroup. The GeometryGroup object creates an amalgamation of the Geometry objects it contains without combining their area. Any number of Geometry objects can be added to a GeometryGroup. The following example uses a GeometryGroup to create a composite Geometry.

XAML
<Canvas  
  xmlns="https://schemas.microsoft.com/client/2007"  
  xmlns:x="https://schemas.microsoft.com/winfx/2006/xaml"> 
  <Path Stroke="Black" StrokeThickness="1" Fill="#CCCCFF">
    <Path.Data>
      <!-- Creates a composite shape from three geometries. -->
      <GeometryGroup FillRule="EvenOdd">
        <LineGeometry StartPoint="10,10" EndPoint="50,30" />
        <EllipseGeometry Center="40,70" RadiusX="30" RadiusY="30" />
        <RectangleGeometry Rect="30,55 100 30" />
      </GeometryGroup>
    </Path.Data>
  </Path> 
</Canvas>

A composite Geometry

A composite Geometry

See Also

Geometry Overview
EllipseGeometry
Geometry
GeometryCollection
LineGeometry
PathGeometry
RectangleGeometry