UIElement.Clip Property
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Gets or sets the Geometry used to define the outline of the contents of a UIElement.
Assembly: System.Windows (in System.Windows.dll)
XMLNS for XAML: Not mapped to an xmlns.
<uiElement> <uiElement.Clip> singleGeometry </uiElement.Clip> </uiElement>
XAML Values
Property Value
Type: System.Windows.Media.GeometryThe geometry to be used for clipping area sizing. The default value is Nothing.
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.