How to change disabled background color of TextBox in WPF

前端 未结 7 2166
野趣味
野趣味 2020-11-27 06:45

I\'ve seen the following thread which is related to my question:

WPF ComboBox: background color when disabled

The above deals with changing the Content Temp

7条回答
  •  孤街浪徒
    2020-11-27 07:28

    For this situation I like to set Focusable=false and set the background color to my desired value (in a data-bound trigger). This is maybe a little hacky, but so is rewriting the control template for the whole TextBox. An alternative to Focusable is IsReadyOnly, but that doesn't work for as many controls. It does ensure the caret disappears, though.

提交回复
热议问题