我目前在 WPF 中为我的 ComboBox 使用这种样式:
<Style TargetType="ComboBox">
<Setter Property="Foreground" Value="White"/>
<Setter Property="Background" Value="#303030"/>
<Setter Property="BorderBrush" Value="#000000"/>
</Style>
当 ComboBox 被禁用时,如何更改它以指定背景颜色?
(这是这个问题的后续:WPF combobox colors)
最佳答案
<Style TargetType="ComboBox">
<Setter Property="Foreground" Value="White"/>
<Setter Property="Background" Value="#303030"/>
<Setter Property="BorderBrush" Value="#000000"/>
<Style.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Background" Value="#101010"/>
</Trigger>
</Style.Triggers>
</Style>
关于WPF 组合框 : background color when disabled,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2388833/