title: How To Style Button's Hover And Click Foreground?
body: <p>I am new to <code>Styles</code> and not sure on the best way to create a <code>Button</code> style to change the <code>Foreground</code> of <code>IsMouseOver</code> and <code>IsPressed</code>. I used a <code>Border</code> for a template because it has a <code>CornerRadius</code> and background and border properties. But <code>Border</code> does not have a <code>Foreground</code> property. Using <code>Button</code> as the template doesn't work well since the default look isn't being overridden. </p>
  
  <p>What is a better way to style a <code>Button</code> template with <code>Foreground</code> behavior? Maybe using a label inside the border?</p>
  
  <p>Here is the App.xaml:</p>
  
  <pre><code>&lt;Application.Resources&gt;
      &lt;Style TargetType="Button" x:Key="MyButton"&gt;
          &lt;Setter Property="SnapsToDevicePixels" Value="true"/&gt;
          &lt;Setter Property="OverridesDefaultStyle" Value="true"/&gt;
          &lt;Setter Property="MinHeight" Value="34"/&gt;
          &lt;Setter Property="Foreground" Value="White"/&gt;
          &lt;Setter Property="Template"&gt;
              &lt;Setter.Value&gt;
                  &lt;ControlTemplate TargetType="Button"&gt;
                      &lt;Border Name="shortcutbutton"  
                      BorderThickness="1"
                      BorderBrush="Black"
                      Background="Gray"&gt;
                          &lt;ContentPresenter Margin="2" 
                                    HorizontalAlignment="Center"
                                    VerticalAlignment="Center" 
                                    RecognizesAccessKey="True"/&gt;
                      &lt;/Border&gt;
                      &lt;ControlTemplate.Triggers&gt;
                          &lt;Trigger Property="IsMouseOver" Value="true"&gt;
                              &lt;Setter TargetName="shortcutbutton" Property="Background" Value="#FFDADADA" /&gt;
                              &lt;Setter TargetName="shortcutbutton" Property="BorderBrush" Value="#EEEEEE" /&gt;
                              &lt;!--&lt;Setter TargetName="Border" Property="Foreground" Value="Black" /&gt;--&gt;
                          &lt;/Trigger&gt;
                          &lt;Trigger Property="IsPressed" Value="true"&gt;
                              &lt;Setter TargetName="shortcutbutton" Property="Background" Value="DarkGray" /&gt;
                              &lt;Setter TargetName="shortcutbutton" Property="BorderBrush" Value="Black" /&gt;
                              &lt;!--&lt;Setter TargetName="Border" Property="Foreground" Value="Red" /&gt;--&gt;
                          &lt;/Trigger&gt;
                      &lt;/ControlTemplate.Triggers&gt;
                  &lt;/ControlTemplate&gt;
              &lt;/Setter.Value&gt;
          &lt;/Setter&gt;
      &lt;/Style&gt;
  &lt;/Application.Resources&gt;
  </code></pre>
  
  <p>And the xaml:</p>
  
  <pre><code>    &lt;StackPanel HorizontalAlignment="Center" Height="100" VerticalAlignment="Center" Width="100"&gt;
          &lt;Button Content="Button" Height="41" Style="{DynamicResource MyButton}"/&gt;
      &lt;/StackPanel&gt;
  </code></pre>