Share via


GeometryGroup

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

Represents a composite geometry, composed of other Geometry objects.

<GeometryGroup ...>
  oneOrMoreGeometries
</GeometryGroup>

XAML Values

Value

Description

oneOrMoreGeometries

One or more object elements that derive from Geometry. These can be any combination of EllipseGeometry, GeometryGroup, LineGeometry, PathGeometry, and RectangleGeometry. Object elements defined here become members of the Children collection when scripting accesses the Children property at run time.

Managed Equivalent

GeometryGroup

Remarks

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

In XAML, GeometryGroup uses Children as its content property and supports the use of implicit collections. 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 GeometryGroup objects is permitted.

Example

The following example uses a GeometryGroup object to create a composite geometry. The GeometryGroup creates an amalgamation of the Geometry objects it contains without combining their area. You can add any number of Geometry objects to a GeometryGroup.

<Canvas  
  xmlns="https://schemas.microsoft.com/winfx/2006/xaml/presentation"  
  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>