Freigeben über


Opacity (Brush)

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Gets or sets the degree of opacity of a Brush.

<object Opacity="Double"  .../>
value = object.Opacity
object.Opacity = value

Property Value

Type: Double

The value of the Opacity property, expressed as a value between 0 and 1.0.

This property is read/write. The default value is 1.0.

Managed Equivalent

Opacity

Remarks

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

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

See Also

Reference