Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WPF Label Foreground Color

I have 2 Labels in a StackPanel and set a Foreground color to both of them... The second one shows as black, when it shouldn't.

<StackPanel HorizontalAlignment="Right" Orientation="Horizontal"  Grid.Column="4" Grid.Row="0" Width="Auto" Margin="0,0,20,0">     <Label Content="{lex:LocText CGI, Suffix=:}" Foreground="#FFE0E0E0" FontSize="24" VerticalAlignment="Bottom" Margin="0,0,0,10" HorizontalAlignment="Right" />     <Label Content="{Binding Cgi}" ContentStringFormat="{}{0}%" Foreground="#FFE0E0E0" FontSize="24" VerticalAlignment="Bottom" Margin="0,0,0,10" HorizontalAlignment="Right" /> </StackPanel> 

Is there something I'm doing wrong?

like image 494
JuHwon Avatar asked Feb 04 '13 13:02

JuHwon


People also ask

How do I change the color of a label in WPF?

Then, from the toolbar select the textblock and name the application name then select the buttons and place it on the screen and then set the labels on the screen. Then, set the label properties such as changing the background color to the corresponding color. And keep the label's content as blank.


1 Answers

I checked your XAML, it works fine - e.g. both labels have a gray foreground.
My guess is that you have some style which is affecting the way it looks...

Try moving your XAML to a brand-new window and see for yourself... Then, check if you have any themes or styles (in the Window.Resources for instance) which might be affecting the labels...

like image 129
Blachshma Avatar answered Sep 28 '22 01:09

Blachshma