WPF 组合框 : background color when disabled

标签 wpf windows combobox colors

我目前在 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/

相关文章:

windows - 建议使用 MFC?

java - 如何自动填充组合框? java

c++ - 设置 QComboBox 大小多个项目

WPF:如何在代码中定位鼠标光标?

c# - 切换按钮两种方式绑定(bind)不起作用(通用 Windows 平台)

c# - 应用程序每次运行时都在提取自身

windows - 如何在Windows上使用gstreamer播放.wav音频文件?

wpf - 组合框未正确绑定(bind)到 SelectedItem

c# - WPF中的轻量级处理动画资源?

c# - 隐藏 webBrowser 滚动条 wpf