WPF Label Foreground Color

JuHwon picture JuHwon · Feb 4, 2013 · Viewed 115.7k times · Source

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?

Answer

Blachshma picture Blachshma · Feb 4, 2013

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...