Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

UIElement.Clip Property

Gets or sets the Geometry used to define the outline of the contents of a UIElement.

Namespace:  System.Windows
Assembly:  System.Windows (in System.Windows.dll)

public Geometry Clip { get; set; }
<uiElement>
  <uiElement.Clip>
    singleGeometry
  </uiElement.Clip>
</uiElement>

XAML Values

singleGeometry

Exactly one object element for an object that derives from Geometry. This is typically one of the classes defined by Silverlight: EllipseGeometry, GeometryGroup, LineGeometry, PathGeometry, RectangleGeometry.

Property Value

Type: System.Windows.Media.Geometry
The geometry to be used for clipping area sizing. The default value is null.

Dependency property identifier field: ClipProperty

A UIElement outside the geometry will be visually clipped in the rendered layout. The geometry does not have to be rectangular.

The clipped area is the "outside" of the geometry. In other words, the content that is shown (not clipped) is the area of the geometry that would otherwise have a Fill if the geometry were used as data for a Path rather than for clipping. The clipped area is any area that falls outside the geometry overlay. For complex geometries, the areas that are clipped or not clipped are influenced by the geometry's FillRule.

Clipping by using just LineGeometry causes total clipping because the line by itself has no dimension. EllipseGeometry, GeometryGroup, or RectangleGeometry is probably the simplest to use; however, you can use a PathGeometry for more complex results.

You can specify a complex geometry for Clip if you specify a single GeometryGroup as the value and populate the group with child geometries

An alternative approach for showing only part of a UIElement visually is to use OpacityMask, using either a RadialGradientBrush or an ImageBrush that uses a transparency mask. If you use the OpacityMask technique, you can create "bleed" effects against the background. The Clip technique always results in hard edges where the clip is applied.

For example code, see How to: Crop an Object.

For a XAML example, see How to: Crop an Object.

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

Show:
© 2014 Microsoft