gpt4 book ai didi

wpf - #FFFAFAFA 不是 system.windows.controls.panel.background 的有效值

转载 作者:行者123 更新时间:2023-12-04 01:30:10 32 4
gpt4 key购买 nike

我只是在写我自己的个人风格。
一切正常,样式中没有错误。

我有以下代码

<Color x:Key="DialogButtonBorderBrushColor" A="255" R="177" G="177" B="177" />

<SolidColorBrush x:Key="BorderBrush" Color="{StaticResource DialogButtonBorderBrushColor}" />

我的对话框按钮有一种样式。
<Style x:Key="DialogButtonStyle" TargetType="Button">
<Setter Property="MinWidth" Value="80" />
<Setter Property="MinHeight" Value="30" />
<Setter Property="BorderBrush" Value="{StaticResource BorderBrush}" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="Background" Value="{StaticResource DialogButtonBackgroundColor1}"/>
</Style>

我只是在 xaml Button 中使用这个 dialogBu​​ttonStyle 作为样式。
但是当我使用这种风格时,我收到以下错误:

#FFFAFAFA is not a valid value for the System.Windows.Controls.Panel.Background property on setter.



我真的不知道该怎么办。
你能帮助我吗?谢谢。

最佳答案

<Setter Property="Background" Value="{StaticResource DialogButtonBackgroundColor1}"/>Background属性(property)期待Brush值(value)。从资源名称来看,DialogButtonBackgroundColor1Color .您应该使用类似于 BorderBrush 的 Brush 资源

关于wpf - #FFFAFAFA 不是 system.windows.controls.panel.background 的有效值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51856419/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com