Gets or sets the brush used to alter the opacity of select regions of this object.
| XAML | < object ...>
< object. OpacityMask>
< Brush .../>
</ object. OpacityMask>
</ object>
|
| Scripting | value = object.OpacityMask object.OpacityMask = value |
Property Value
Brush
A Brush that describes the opacity of this object.
This property is read/write. The default value is null.
Examples
The following example creates a RadialGradientBrush with three gradient stops in the implicit GradientStopCollection. The three gradient stops specify a brush with a varying transparency, which is then applied as the OpacityMask for an Image.
| XAML |
<Canvas
xmlns="http://schemas.microsoft.com/client/2007"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Image Source="sampleImages/forest.jpg" Height="100">
<Image.OpacityMask>
<RadialGradientBrush Center="0.5,0.5">
<!-- This gradient stop is partially transparent. -->
<GradientStop Color="#00000000" Offset="1" />
<!-- This gradient stop is partially transparent. -->
<GradientStop Color="#20000000" Offset="0.8" />
<!-- This gradient stop is fully opaque. -->
<GradientStop Color="#FF000000" Offset="0" />
</RadialGradientBrush>
</Image.OpacityMask>
</Image>
</Canvas>
|
The following illustration shows the rendered result of the preceding code.
RadialGradientBrush applied to OpacityMask of an image
Applies To
Canvas,
Ellipse,
Glyphs,
Image,
InkPresenter,
Line,
MediaElement,
Path,
Polygon,
Polyline,
Rectangle,
TextBlock
See Also
Silverlight Brushes Overview
Imaging Overview