title: WPF button style and template
body: <p>So i have the button and its style:</p>
  <pre><code>&lt;Style TargetType=&quot;Button&quot; x:Key=&quot;BaseButtonStyle&quot;&gt;
      &lt;Setter Property=&quot;FontWeight&quot; Value=&quot;Bold&quot;  /&gt;
      &lt;Setter Property=&quot;Width&quot; Value=&quot;120&quot; /&gt;
      &lt;Setter Property=&quot;Height&quot; Value=&quot;30&quot; /&gt;
      &lt;Setter Property=&quot;BorderBrush&quot; Value=&quot;#1FA3FF&quot;  /&gt;
  &lt;/Style&gt;
  
  &lt;Style TargetType=&quot;{x:Type Button}&quot; x:Key=&quot;MyButtonStyle&quot;  BasedOn=&quot;{StaticResource BaseButtonStyle}&quot;&gt;          
      &lt;Setter Property=&quot;Background&quot; Value=&quot;#1FA3EB&quot;  /&gt;
      &lt;Setter Property=&quot;Foreground&quot; Value=&quot;#FFFFFF&quot;  /&gt;
  &lt;/Style&gt;
  
  &lt;Button Style=&quot;{StaticResource MyButtonStyle}&quot; Content=&quot;My text&quot; /&gt;
  </code></pre>
  <p>It works fine and i have the following results (aquamarine background isn't part of Button, it belongs to Window):</p>
  <p><img src="https://i.stack.imgur.com/Lp1ZI.png" alt="enter image description here" /></p>
  <p>But then i want to replace button's content and change my style so:</p>
  <pre><code>&lt;Style TargetType=&quot;{x:Type Button}&quot; x:Key=&quot;MyButtonStyle&quot;  BasedOn=&quot;{StaticResource BaseButtonStyle}&quot;&gt;          
      &lt;Setter Property=&quot;Background&quot; Value=&quot;#1FA3EB&quot;  /&gt;
      &lt;Setter Property=&quot;Foreground&quot; Value=&quot;#FFFFFF&quot;  /&gt;
  
      &lt;Setter Property=&quot;Template&quot;&gt;
          &lt;Setter.Value&gt;
              &lt;ControlTemplate&gt;
                  &lt;StackPanel Orientation=&quot;Horizontal&quot;&gt;
                      &lt;TextBlock Text=&quot;√&quot; /&gt;
                      &lt;TextBlock Text=&quot;{TemplateBinding Button.Content}&quot; /&gt;
                  &lt;/StackPanel&gt;
              &lt;/ControlTemplate&gt;
          &lt;/Setter.Value&gt;
      &lt;/Setter&gt;
  &lt;/Style&gt;
  </code></pre>
  <p>and now my button becomes awful:</p>
  <p><img src="https://i.stack.imgur.com/Hrlgl.png" alt="enter image description here" /></p>
  <p>As you can see my button lost its borders and background and it doesn't change its view when mouse is over it. Where am i wrong and what should i do to prevent it?</p>
  <p><strong>UPD</strong></p>
  <p>when i do something like this:</p>
  <pre><code>&lt;Style TargetType=&quot;{x:Type Button}&quot; x:Key=&quot;MyButtonStyle&quot;  BasedOn=&quot;{StaticResource BaseButtonStyle}&quot;&gt;          
      &lt;Setter Property=&quot;Background&quot; Value=&quot;#1FA3EB&quot;  /&gt;
      &lt;Setter Property=&quot;Foreground&quot; Value=&quot;#FFFFFF&quot;  /&gt;
      &lt;Setter Property=&quot;Content&quot; &gt;
          &lt;Setter.Value&gt;
              &lt;StackPanel Orientation=&quot;Horizontal&quot;&gt;
                  &lt;TextBlock Text=&quot;√&quot; /&gt;
                  &lt;TextBlock Text=&quot;{TemplateBinding Button.Content}&quot; /&gt;
              &lt;/StackPanel&gt;
          &lt;/Setter.Value&gt;
      &lt;/Setter&gt;
  &lt;/Style&gt;
  </code></pre>
  <p>then i get this result:</p>
  <p><img src="https://i.stack.imgur.com/R7bbE.png" alt="enter image description here" /></p>
  <p>As you can see this is similar to the firstresult, where the check mark is missing</p>