title: WPF change background of disabled buttons
body: <p>I am trying to learn WPF and I have made a simple Tic Tac Toe application. The application works but I'm trying to style it a bit. I can't find out how to set the button disabled background for all my buttons (and keep the content visible). My question is how set up the code in the resource dictionary? The commented code is what I tried. To give all buttons the same style I added a resource dictionary.</p>
  
  <p>The resource dictionary</p>
  
  <pre><code>&lt;ResourceDictionary 
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"&gt;
  
      &lt;Style TargetType="Button"&gt;
          &lt;Style.Triggers&gt;
              &lt;Trigger Property="IsEnabled" Value="false"&gt;
                  &lt;Setter Property="Template"&gt;
                      &lt;Setter.Value&gt;
                          &lt;ControlTemplate&gt;
                              &lt;!--&lt;Border BorderBrush="Black" BorderThickness="1"&gt;
                                  &lt;TextBlock Text="{Binding Path=SelectedDate,
                                   StringFormat={}{0:d},
                                   RelativeSource={RelativeSource TemplatedParent}}"
                                   VerticalAlignment="Center" HorizontalAlignment="Left"
                                   Padding="4,0,0,0" /&gt;
                              &lt;/Border&gt;--&gt;
                              &lt;!--&lt;Border BorderBrush="Aquamarine" BorderThickness="1"&gt;&lt;/Border&gt;--&gt;
                              &lt;!-- Outer Rectangle with rounded corners. --&gt;
                              &lt;!-- Present Content (text) of the button. --&gt;                         
                          &lt;/ControlTemplate&gt;
                      &lt;/Setter.Value&gt;
                  &lt;/Setter&gt;
              &lt;/Trigger&gt;
          &lt;/Style.Triggers&gt;
      &lt;/Style&gt;
  
  &lt;/ResourceDictionary&gt;
  </code></pre>
  
  <p>App.xaml</p>
  
  <pre><code>  &lt;Application x:Class="FirstApplication.App"
               xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
               xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
               StartupUri="MainWindow.xaml"&gt;
      &lt;Application.Resources&gt;
              &lt;ResourceDictionary Source="ResourceDictionary.xaml" /&gt;
      &lt;/Application.Resources&gt;
  &lt;/Application&gt;
  </code></pre>
  
  <p>MainWindow.xaml</p>
  
  <pre><code>&lt;Window x:Class="FirstApplication.MainWindow"
          xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
          xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
          Title="MainWindow" Height="500" Width="525"&gt;
  
      &lt;Grid Margin="0,0,0.4,-19.2" Name="controlGrid"&gt;
          &lt;Button x:Name="A" Content="" HorizontalAlignment="Left" Margin="117,59,0,0" VerticalAlignment="Top" Width="75" Height="75" Click="button_click" Background="#FFEBEB33" MouseEnter="button_enter" MouseLeave="button_leave" FontSize="36"/&gt;
          &lt;Button x:Name="B" Content="" HorizontalAlignment="Left" Margin="223,59,0,0" VerticalAlignment="Top" Width="75" Height="75" Click="button_click" Background="#FFEBEB33" MouseEnter="button_enter" MouseLeave="button_leave" FontSize="36"/&gt;
          &lt;Button x:Name="C" Content="" HorizontalAlignment="Left" Margin="330,59,0,0" VerticalAlignment="Top" Width="75" Height="75" Click="button_click" Background="#FFEBEB33" MouseEnter="button_enter" MouseLeave="button_leave" FontSize="36"/&gt;
          &lt;Button x:Name="D" Content="" HorizontalAlignment="Left" Margin="117,157,0,0" VerticalAlignment="Top" Width="75" Height="75" Click="button_click" RenderTransformOrigin="0.302,0.614" Background="#FFEBEB33" MouseEnter="button_enter" MouseLeave="button_leave" FontSize="36"/&gt;
          &lt;Button x:Name="E" Content="" HorizontalAlignment="Left" Margin="223,157,0,0" VerticalAlignment="Top" Width="75" Height="75" Click="button_click" Background="#FFEBEB33" MouseEnter="button_enter" MouseLeave="button_leave" FontSize="36"/&gt;
          &lt;Button x:Name="F" Content="" HorizontalAlignment="Left" Margin="330,157,0,0" VerticalAlignment="Top" Width="75" Height="75" Click="button_click" Background="#FFEBEB33" MouseEnter="button_enter" MouseLeave="button_leave" FontSize="36"/&gt;
          &lt;Button x:Name="G" Content="" HorizontalAlignment="Left" Margin="117,255,0,0" VerticalAlignment="Top" Width="75" Height="75" Click="button_click" Background="#FFEBEB33" MouseEnter="button_enter" MouseLeave="button_leave" FontSize="36"/&gt;
          &lt;Button x:Name="H" Content="" HorizontalAlignment="Left" Margin="223,255,0,0" VerticalAlignment="Top" Width="75" Height="75" Click="button_click" Background="#FFEBEB33" MouseEnter="button_enter" MouseLeave="button_leave" FontSize="36"/&gt;
          &lt;Button x:Name="I" Content="" HorizontalAlignment="Left" Margin="330,255,0,0" VerticalAlignment="Top" Width="75" Height="75" Click="button_click" Background="#FFEBEB33" MouseEnter="button_enter" MouseLeave="button_leave" FontSize="36"/&gt;
          &lt;ToolBar Margin="0,0,0,450.6"&gt;
              &lt;Button Name="newButton" Click="newButton_Click"&gt;New&lt;/Button&gt;
          &lt;/ToolBar&gt;
      &lt;/Grid&gt;
  &lt;/Window&gt;
  </code></pre>