How to change disabled background color of TextBox in WPF

前端 未结 7 2008
野趣味
野趣味 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:36

    Try to avoid redefining control templates where you can. They tend to add a lot of code overhead and can become difficult to maintain over time.

    I would use the following code in the Loaded event:

    ClassicBorderDecorator o = VisualTreeHelper.GetChild(this.textBox1, 0) as ClassicBorderDecorator;
    if (o != null)
    {
        o.Background = new SolidColorBrush(Colors.Transparent);
    }
    
    0 讨论(0)
提交回复
热议问题