WPF #FF Color Bug on Windows 8.1, Visual Studio 2012

你。 提交于 2019-12-13 02:37:18

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!