title: Setting WPF control background image using styles?
body: <p>I have a set of buttons inside a stack panel. I want them all to have a background image. How can i do it using styles? since i don't want to set manually the Background image for each button.</p>
  
  <p>Here is a code snippet:</p>
  
  <pre><code>    &lt;StackPanel Orientation="Horizontal" Height="100px" VerticalAlignment="Top"&gt;
          &lt;StackPanel.Resources&gt;
              &lt;Style TargetType="Button"&gt;
                  &lt;Setter Property="Margin" Value="2,4" /&gt;
              &lt;/Style&gt;
          &lt;/StackPanel.Resources&gt;
          &lt;Button Width="127px" Height="79px" VerticalAlignment="Bottom"&gt;
              &lt;Button.Background&gt;
                  &lt;ImageBrush ImageSource="images/Tab.png" /&gt;
              &lt;/Button.Background&gt;
          &lt;/Button&gt;
          &lt;Button&gt;A&lt;/Button&gt;
          &lt;Button&gt;R&lt;/Button&gt;
          &lt;Button&gt;S&lt;/Button&gt;
      &lt;/StackPanel&gt;
  </code></pre>
  
  <p>Thanks.</p>