Setting combo box foreground color for the disabled state

爷,独闯天下 提交于 2019-12-24 22:58:25

问题


I want to change color of combo box for diasbled state to more darker one. Please let me know how do achieve this using triggers or any other way. Thanks !!


回答1:


Change the color in a simple property trigger:

<Style TargetType="ComboBox">
    <Style.Triggers>
        <Trigger Property="IsEnabled" Value="False">
            <Setter Property="Foreground" Value="Green"/>
        </Trigger>
    </Style.Triggers>
</Style>



回答2:


Try this:-

<Trigger Property="IsEnabled" Value="false">
        <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>            
    </Trigger>

In my case I set DyanmicResource to SystemColors.GrayTextBrushKey

You can set according to your requirement Check this link out



来源:https://stackoverflow.com/questions/17723565/setting-combo-box-foreground-color-for-the-disabled-state

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!