UIElement.Clip Property

July 28, 2014

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)
XMLNS for XAML: Not mapped to an xmlns.

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 Windows Phone: 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.

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Show:
© 2014 Microsoft