我只是在写我自己的个人风格。一切正常,样式中没有错误。
我有以下代码
<Color x:Key="DialogButtonBorderBrushColor" A="255" R="177" G="177" B="177" />
<SolidColorBrush x:Key="BorderBrush" Color="{StaticResource DialogButtonBorderBrushColor}" />
Run Code Online (Sandbox Code Playgroud)
我的对话框按钮有一种样式。
<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>
Run Code Online (Sandbox Code Playgroud)
我只是在 xaml Button 中使用这个 dialogButtonStyle 作为样式。但是当我使用这种风格时,我收到以下错误:
#FFFAFAFA不是 setter 上 System.Windows.Controls.Panel.Background 属性的有效值。
我真的不知道该怎么办。你能帮助我吗?谢谢。
<Setter Property="Background" Value="{StaticResource DialogButtonBackgroundColor1}"/>
Background财产Brush期望值。从资源名称来看,DialogButtonBackgroundColor1是一个Color. 您应该使用类似的 Brush 资源BorderBrush
| 归档时间: |
|
| 查看次数: |
1419 次 |
| 最近记录: |