开发者

WPF ComboBox: background color when disabled

开发者 https://www.devze.com 2022-12-22 05:13 出处:网络
I currently use this style for my ComboBox in WPF: <Style TargetType=\"ComboBox\"> <Setter Property=\"Foreground\" Value=\"White\"/>

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

0

精彩评论

暂无评论...
验证码 换一张
取 消