I currently use this style for my ComboBox in WPF:
<Style TargetType="ComboBox">
<Setter Property="Foreground" Value="White"/>
<Setter Property="Background" Value="#303030"/>
<Setter Property="BorderBrush" Value="#000000"/>
</Style>
How can I change it to specify the background color when the ComboBox is disabled?
(this is a follow-up to this question: WPF comb开发者_开发知识库obox 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>
I ended up using the style used here as a base, and this did allow to set the background color when disabled:
http://msdn.microsoft.com/en-us/library/ms752094%28v=VS.85%29.aspx
精彩评论