如何在资源字典中正确定义颜色?

时间:2022-01-31 14:10:02

The following doesn't work, runtime tells me it cannot convert #FFFFFFAE to a color.

以下不起作用,运行时告诉我它无法将#FFFFFFAE转换为颜色。

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

    <Color x:Key="ItemHeaderBack" >#FFFFFFAE</Color>

</ResourceDictionary>

1 个解决方案

#1


8  

I tried using your exact definition like this and it worked. How do you use it?

我尝试使用你这样的确切定义并且它有效。你如何使用它?

<Canvas.Background>
    <SolidColorBrush Color="{StaticResource ItemHeaderBack}"/>
</Canvas.Background>

#1


8  

I tried using your exact definition like this and it worked. How do you use it?

我尝试使用你这样的确切定义并且它有效。你如何使用它?

<Canvas.Background>
    <SolidColorBrush Color="{StaticResource ItemHeaderBack}"/>
</Canvas.Background>