禁用列表框是不是在不断变化的风格背景颜色 [英] Disabling Listbox is not changing background color in style

查看:199
本文介绍了禁用列表框是不是在不断变化的风格背景颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个简单的风格,不改变的ListBox 背景的ListBox 已禁用:

I have this simple style that does not change the ListBox Background when the ListBox is disabled:

<Style TargetType="ListBox" >                    
    <Style.Triggers>
        <Trigger Property="IsEnabled" Value="True">
            <Setter Property="Background" Value="Red"/>
        </Trigger>
        <Trigger Property="IsEnabled" Value="False">
            <Setter Property="Background" Value="Orange"/>
        </Trigger>
    </Style.Triggers>
</Style>

史努比不帮助我在这一个,没有覆盖的模板我想不出一个简单的方法。任何人有一个简单的方法来得到这个工作? TIA。

Snoop does not help me on this one and I cannot figure a simple way without overriding templates. Anyone have a simple way to get this working? TIA.

推荐答案

要做到这一点的唯一方法是通过重写模板

The only way to do this is by overriding the template

这篇关于禁用列表框是不是在不断变化的风格背景颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆