This documentation is archived and is not being maintained.

DrawingGroup.ClipGeometry Property

Gets or sets the clip region of this DrawingGroup. This is a dependency property.

Namespace: System.Windows.Media
Assembly: PresentationCore (in presentationcore.dll)
XML Namespace:

public Geometry ClipGeometry { get; set; }
/** @property */
public Geometry get_ClipGeometry ()

/** @property */
public void set_ClipGeometry (Geometry value)

public function get ClipGeometry () : Geometry

public function set ClipGeometry (value : Geometry)

For XAML information, see the Geometry type.

Property Value

The Geometry that is used to clip this DrawingGroup. The default value is a null reference (Nothing in Visual Basic).

Identifier Field


Metadata Flags


Drawings outside the geometry are clipped from the DrawingGroup when it is rendered. The geometry does not have to be rectangular; for example, you can use an EllipseGeometry to clip to an elliptical shape.

DrawingGroup operations are applied in the following order:

  1. OpacityMask

  2. Opacity

  3. BitmapEffect

  4. ClipGeometry

  5. GuidelineSet

  6. Transform

This example shows how to define a clip region for a Drawing.

Use a DrawingGroup to define a clip for a Drawing. The DrawingGroup class is the only type of Drawing object that enables you to define your own clip region.

Use a Geometry to describe the clip and apply it to the ClipGeometry property of the DrawingGroup object.

The following example uses a DrawingGroup to apply a ClipGeometry to several GeometryDrawing objects.

The following illustration shows the output that the example produces. The illustration shows the DrawingGroup before and after the elliptical clip is applied.

DrawingGroup with a defined clip region
  Background="White" Margin="20">

  <Border BorderBrush="Gray" BorderThickness="1" 
    HorizontalAlignment="Left" VerticalAlignment="Top"
    <Image Stretch="None" HorizontalAlignment="Left">
        <DrawingImage PresentationOptions:Freeze="True">

            <!-- A DrawingGeometry with an elliptical clip region. -->
              <GeometryDrawing Brush="Pink">
                  <RectangleGeometry Rect="0,0,50,85" />
              <GeometryDrawing Brush="Lime" 
                Geometry="M 25,25 L 0,50 25,75 50,50 25,25 25,0">
                  <Pen Thickness="10" Brush="Black" />
              <GeometryDrawing Brush="Lime">
                  <EllipseGeometry Center="10,10" RadiusX="5" RadiusY="5" />
                  <Pen Thickness="2" Brush="Black" />

                <EllipseGeometry Center="25,50" RadiusX="25" RadiusY="50" />


Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0