Brush..::.Opacity Property
This page is specific to:Microsoft Version:3.03.5Silverlight 34.0
.NET Framework Class Library for Silverlight
Brush..::.Opacity Property

Gets or sets the degree of opacity of a Brush.

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

'Usage

Dim instance As Brush
Dim value As Double

value = instance.Opacity

instance.Opacity = value

'Declaration

Public Property Opacity As Double
    Get
    Set

Property Value

Type: System..::.Double
The value of the Opacity property is expressed as a value between 0 and 1.0. The default value is 1.0.
Remarks

Dependency property identifier field: OpacityProperty

An Opacity value of 0 indicates that the brush is completely transparent, while a value of 1 indicates that the brush is completely opaque. A value of 0.5 indicates the brush is 50% opaque, a value of 0.725 indicates the brush is 72.5% opaque, and so on. Values less than 0 are treated as 0, while values greater than 1 are treated as 1.

The following illustrations shows a red rectangle with several different Opacity values.

Opacity = 1

ms611576.JOLT_opacity100percent(en-us,VS.95).gif
Opacity = 0.7

ms611576.JOLT_opacity70percent(en-us,VS.95).gif
Opacity = 0.5

ms611576.JOLT_opacity50percent(en-us,VS.95).gif
Opacity = 0.2

ms611576.JOLT_opacity20percent(en-us,VS.95).gif
Opacity = 0

ms611576.JOLT_opacity0percent(en-us,VS.95).gif

An Opacity of 0 applied to any Brush is still hit testable. Only a true null Brush is not hit testable. You could however set IsHitTestVisible to false to remove any hit testing against the UIElement where the Brush is ultimately applied.

Platforms

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

See Also

Reference

Other Resources

© 2009 Microsoft Corporation. All rights reserved.   Terms of Use | Trademarks | Privacy Statement
Page view tracker
Rate the Lightweight library
x
Lightweight builds on ScriptFree (loband) by adding features you've requested: a SearchBox and default code language selection.
Do you like the SearchBox?
Do you like the tabbed code blocks?
How useful is this topic?
Tell us more.
Thanks
x
You're helping to improve MSDN Online.
Feedback
Switch View
Classic
Lightweight Beta
ScriptFree
Switch View