title: WPF - Set the same style to multiple controls
body: <p>Is it possible to set the same style to multiple controls?
  I was tried the following way. But 1st Button style was not applied correctly, in second style applied fine.</p>
  
  <p><strong>Design:</strong></p>
  
  <pre><code>&lt;StackPanel Orientation="Horizontal"&gt;
      &lt;TextBlock Foreground="White" Margin="0,0,5,0"&gt;1st Button&lt;/TextBlock&gt;
      &lt;Button Style="{StaticResource ViewButton}" /&gt;
      &lt;TextBlock Foreground="White" Margin="25,0,5,0"&gt;2nd Button&lt;/TextBlock&gt;
      &lt;Button Style="{StaticResource ViewButton}" /&gt;
  &lt;/StackPanel&gt;
  </code></pre>
  
  <p><strong>Resource:</strong></p>
  
  <pre><code>&lt;Style x:Key="ViewButton" TargetType="Button" BasedOn="{StaticResource ButtonStyle}"&gt;
      &lt;Setter Property="Content"&gt;
          &lt;Setter.Value&gt;
              &lt;StackPanel Orientation="Horizontal"&gt;
                  &lt;Image Source="/Images/View.png" Stretch="None" Width="24" Height="24" /&gt;
                  &lt;TextBlock Margin="5,0,0,0" HorizontalAlignment="Center" VerticalAlignment="Center" FontWeight="Bold"&gt;View&lt;/TextBlock&gt;
              &lt;/StackPanel&gt;
          &lt;/Setter.Value&gt;
      &lt;/Setter&gt;
      &lt;Setter Property="Padding" Value="2,0,10,0"/&gt;
  &lt;/Style&gt;
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/ZVmer.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZVmer.png" alt="enter image description here"></a></p>