title: WPF: Change Colors of Elements in User Control if "IsEnabled=False"
body: <p>I have a UserControl which consists of a grid with 3 columns:
      
  
  <pre><code>Name="Test"&gt;
  
  &lt;UserControl.Resources&gt;
      &lt;ResourceDictionary&gt;
          &lt;ResourceDictionary.MergedDictionaries&gt;
              ...
          &lt;/ResourceDictionary.MergedDictionaries&gt;
      &lt;/ResourceDictionary&gt;
  &lt;/UserControl.Resources&gt;
  
  &lt;Grid Width="{StaticResource DoubleOverallWidthUserControls}" Height="{StaticResource DoubleHeightControls}"&gt;
      &lt;Grid.RowDefinitions&gt;
          &lt;RowDefinition Height="auto" /&gt;
      &lt;/Grid.RowDefinitions&gt;
      &lt;Grid.ColumnDefinitions&gt;
          &lt;ColumnDefinition Width="{StaticResource GridLengthUserControlLabel}" /&gt;
          &lt;ColumnDefinition Width="{StaticResource GridLengthUserControlContent}" /&gt;
          &lt;ColumnDefinition Width="{StaticResource GridLengthUserControlUnits}" /&gt;
      &lt;/Grid.ColumnDefinitions&gt;
  
      &lt;Border
          Grid.Row="0"
          Grid.Column="0"
          BorderBrush="{StaticResource BrushTextInputBorder}"
          BorderThickness="0,0,0,1"
          Cursor="Arrow"&gt;
          &lt;TextBlock
              x:Name="TextBlockLabel"
              Width="{StaticResource DoubleWidthUserControlLabel}"
              VerticalAlignment="Center"
              DockPanel.Dock="Top"
              TextAlignment="Left" /&gt;
      &lt;/Border&gt;
      &lt;Border BorderBrush="{StaticResource BrushBorder}" CornerRadius="3,3,0,0" Grid.Row="0"
          Grid.Column="1" Background="White"&gt;
      &lt;TextBox
          x:Name="TextBoxText"
          Width="{StaticResource DoubleWidthUserControlContent}" /&gt;
          &lt;Border.Style&gt;
              &lt;Style TargetType="Border"&gt;
                  &lt;Style.Triggers&gt;
                      &lt;DataTrigger Binding="{Binding ElementName=Test, Path=IsEnabled}" Value="False"&gt;
                          &lt;Setter Property="Background" Value="Gray"&gt;&lt;/Setter&gt;
                      &lt;/DataTrigger&gt;
                  &lt;/Style.Triggers&gt;
              &lt;/Style&gt;
          &lt;/Border.Style&gt;
      &lt;/Border&gt;
  
      &lt;TextBlock
          x:Name="TextBlockUnit"
          Grid.Row="0"
          Grid.Column="2"
          Width="{StaticResource DoubleWidthUserControlUnits}"
          Margin="10,0,0,0"
          VerticalAlignment="Center" /&gt;
  &lt;/Grid&gt;
  </code></pre>
  
  <p></p>
  
  <p>Now I want to change the following things in my control if it is disabled:</p>
  
  <ul>
  <li>column 1: grid bottom border color</li>
  <li>column 2: background color of the white border element in which the transparent textbox is wrapped</li>
  </ul>
  
  <p>can someone help me?</p>