title: WPF: Change background color of border on left mouse button down
body: <p>Below is a style I use for buttons in my application. Now I'm trying to change the background color of the <code>Border</code> element that has the name <code>"Background"</code> when the user clicks the button with the left mouse button.</p>
  
  <p>How do I do that?</p>
  
  <pre><code>&lt;Style TargetType="{x:Type Button}"&gt;
      &lt;Setter Property="Template"&gt;
          &lt;Setter.Value&gt;
              &lt;ControlTemplate TargetType="{x:Type Button}"&gt;
                  &lt;Border BorderBrush="#6e6964" BorderThickness="1" CornerRadius="1" Margin="{TemplateBinding Margin}" SnapsToDevicePixels="True"&gt;
                      &lt;Border BorderBrush="White" BorderThickness="1" CornerRadius="1" SnapsToDevicePixels="True"&gt;
                          &lt;Border Padding="12,4,12,4" SnapsToDevicePixels="True" Name="Background"&gt;
                              &lt;Border.Background&gt;
                                  &lt;LinearGradientBrush StartPoint="0,0" EndPoint="0,1"&gt;
                                      &lt;GradientStop Color="White" Offset="0"/&gt;
                                      &lt;GradientStop Color="#f1f1f1" Offset="1"/&gt;
                                  &lt;/LinearGradientBrush&gt;
                              &lt;/Border.Background&gt;
                              &lt;ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" /&gt;
                          &lt;/Border&gt;
                      &lt;/Border&gt;
                  &lt;/Border&gt;
                  &lt;ControlTemplate.Triggers&gt;
                      &lt;Trigger Property="IsMouseOver" Value="True"&gt;
                          &lt;Setter Property="Background" TargetName="Background"&gt;
                              &lt;Setter.Value&gt;
                                  &lt;LinearGradientBrush StartPoint="0,0" EndPoint="0,1"&gt;
                                      &lt;GradientStop Offset="0" Color="#edf8fb"/&gt;
                                      &lt;GradientStop Offset="1" Color="#e2edf0"/&gt;
                                  &lt;/LinearGradientBrush&gt;
                              &lt;/Setter.Value&gt;
                          &lt;/Setter&gt;
                      &lt;/Trigger&gt;
                  &lt;/ControlTemplate.Triggers&gt;
              &lt;/ControlTemplate&gt;
          &lt;/Setter.Value&gt;
      &lt;/Setter&gt;
  &lt;/Style&gt;
  </code></pre>