Topic Author
Posts: 1
Joined: 28 Nov 2018, 18:04

SetOpacity documentation

28 Nov 2018, 18:18

I had quite a problem with this function: void Brush::SetOpacity(float opacity);

I think that the implementation of this is quite different form what average person would guess. At least I would guess that SetOpacity(0.5f) would set opacity to ~0x7F, SetOpacity(1.0f) would set it to ~0xFF etc... The actual behavior is SetOpacity(0.5f) sets opacity to "xaml defined opacity" * 0.5

I would say it deserves better documentation (the current description "Gets/Sets Opacity" leaves me quite confused).

User avatar
Site Admin
Posts: 2262
Joined: 22 Dec 2011, 19:20

Re: SetOpacity documentation

03 Dec 2018, 14:31

Yes, we wil improve the documentation text of Brush properties to better explain their meaning.

The Brush.Opacity property is used to control opacity of the brush in a generic way, no matter which kind of brush you are using: SolidColorBrush, LinearGradientBrush, RadialGradientBrush, ImageBrush... That opacity value is used during rendering, it doesn't modify other brush properties.

Who is online

Users browsing this forum: No registered users and 3 guests