问题
I've ran across what appears to be some kind of color related but in WPF/XAML on Windows 8.1 with Visual Studio 2012. Using Snoop, I can see that every color assigned as hexadecimal is showing FF appended to the beginning of the hex. So, for example, #DDDDDD becomes #FFDDDDDD.
I'm using Visual Studio 2012 on Windows 8.1 (don't ask)... Latest updates installed as far as I know.
I made a really simple WPF test application. I'm assigning colors in the application like this:
<Application.Resources>
<Style x:Key="Label1" TargetType="Label">
<Setter Property="Background" Value="#18537E" />
<Setter Property="Foreground" Value="#DDDDDD" />
<Setter Property="HorizontalContentAlignment" Value="Center" />
</Style>
</Application.Resources>
My Window (not complete xaml):
<Grid Grid.Column="2">
<Border Style="{StaticResource GridBorder}">
<StackPanel>
<Label Content="{Binding Path=DisplayText}" Style="{StaticResource Label1}"/>
</StackPanel>
</Border>
</Grid>
Can anyone else verify that this is a problem or tell me what I might be doing wrong that's causing this?
回答1:
You're not doing anything wrong. Snoop shows the full hex codes, including the alpha channel, for colors. #FFDDDDDD is exactly the same as #DDDDDD, since the alpha is 100% by default.
来源:https://stackoverflow.com/questions/21686509/wpf-ff-color-bug-on-windows-8-1-visual-studio-2012