Hedge
Hedge

Reputation: 16748

WPF: Set text-Label's transparency?

I have an ordinary Label and want to make it half-transparent. How to do this?

Code is just:

<Label FlowDirection="RightToLeft" FontSize="40" Padding="0" 
       FontFamily="Arial" FontWeight="Bold"">X</Label>

Upvotes: 2

Views: 6487

Answers (2)

rudigrobler
rudigrobler

Reputation: 17133

I am assuming your are talking about a WPF label foreground color? Have a look at the following xaml?

<Label Content="Hallo World" Foreground="#7F000000" />

If you look at the color, the first 2 bytes is the alpha (opacity) then RGB? 0x7F == 50% or

<Label Content="Hello World" Opacity="0.5" />

Will make the whole label (foreground and background) 50% opaque!

Upvotes: 9

Related Questions