title: Wpf Button Style is not applied
body: <p>I have a window that has tow group boxes, each group box has 3 buttons, all of the buttons apply the 3 styles. the styles is:</p>
  
  <pre><code>&lt;Style x:Key="SaveButtonStyle" TargetType="Button" &gt;            
      &lt;Setter Property="Content"&gt;
          &lt;Setter.Value&gt;
              &lt;DockPanel&gt;                       
                  &lt;Image Source="/SalesSolution;component/Images/save.png"  Stretch="UniformToFill" Height="40" Width="40" VerticalAlignment="Center" /&gt;                        
                  &lt;Label Content="Save" HorizontalAlignment="Right" VerticalContentAlignment="Center" VerticalAlignment="Center" HorizontalContentAlignment="Center" FontSize="16" /&gt;
              &lt;/DockPanel&gt;                    
          &lt;/Setter.Value&gt;
      &lt;/Setter&gt;
      &lt;Setter Property="Height" Value="40"/&gt;
      &lt;Setter Property="Width" Value="100"/&gt;
  &lt;/Style&gt;
  
  
  &lt;Style x:Key="UpdateButtonStyle" TargetType="Button"  &gt;
      &lt;Setter Property="Content"&gt;
          &lt;Setter.Value&gt;
              &lt;DockPanel&gt;
                  &lt;Image Source="/SalesSolution;component/Images/Refresh_font_awesome.png"  Stretch="UniformToFill" Height="40" Width="40" VerticalAlignment="Center" /&gt;
                  &lt;Label Content="Update" HorizontalAlignment="Right" VerticalContentAlignment="Center" VerticalAlignment="Center" HorizontalContentAlignment="Center" FontSize="16" /&gt;
              &lt;/DockPanel&gt;
          &lt;/Setter.Value&gt;
      &lt;/Setter&gt;
      &lt;Setter Property="Height" Value="40"/&gt;
      &lt;Setter Property="Width" Value="100"/&gt;
  &lt;/Style&gt;
  
  &lt;Style x:Key="DeleteButtonStyle" TargetType="Button"  &gt;
      &lt;Setter Property="Content"&gt;                    
          &lt;Setter.Value&gt;
              &lt;DockPanel&gt;
                  &lt;Image Source="/SalesSolution;component/Images/delete.png"  Stretch="UniformToFill" Height="40" Width="40" VerticalAlignment="Center" /&gt;
                  &lt;Label Content="Delete" HorizontalAlignment="Right" VerticalContentAlignment="Center" VerticalAlignment="Center" HorizontalContentAlignment="Center" FontSize="16" /&gt;
              &lt;/DockPanel&gt;
          &lt;/Setter.Value&gt;
      &lt;/Setter&gt;
      &lt;Setter Property="Height" Value="40"/&gt;
      &lt;Setter Property="Width" Value="100"/&gt;
  &lt;/Style&gt;
  </code></pre>
  
  <p>The buttons' XAML code:</p>
  
  <pre><code>//These three buttons do not applied  the styles:
       &lt;Button HorizontalAlignment="Left" Name="buttonCompanySave" VerticalAlignment="Center" Click="buttonCompanySave_Click" Margin="188,215,0,323" Style="{StaticResource SaveButtonStyle}" /&gt;
       &lt;Button HorizontalAlignment="Left" Name="buttonCompaniesUpdate" VerticalAlignment="Center" Click="buttonCompanyUpdate_Click" Margin="188,274,0,264" Style="{StaticResource UpdateButtonStyle}" /&gt;
       &lt;Button HorizontalAlignment="Left" Name="buttonCompanyDelete" VerticalAlignment="Center" Click="buttonCompanyDelete_Click" Margin="188,333,0,205" Style="{StaticResource DeleteButtonStyle}" /&gt;
  
  
  
  //These three buttons apply the styles:
      &lt;Button HorizontalAlignment="Left" Name="buttonItemSave" VerticalAlignment="Bottom" Click="buttonItemSave_Click" Style="{StaticResource SaveButtonStyle}" /&gt;
      &lt;Button HorizontalAlignment="Center" Name="buttonItemsUpdate" VerticalAlignment="Bottom" Click="buttonItemsUpdate_Click" Style="{StaticResource UpdateButtonStyle}" /&gt;
      &lt;Button HorizontalAlignment="Right" Name="buttonItemDelete" VerticalAlignment="Bottom" Click="buttonItemDelete_Click" Style="{StaticResource DeleteButtonStyle}" /&gt;
  </code></pre>
  
  <p>The strange problem is: if I move the blank buttons(buttonCompanySave,buttonCompaniesUpdate,buttonCompanyDelete) to the other group box, they apply the styles !. I try to figure out this problem but I don't find the solution, I even create new group boxes and buttons.</p>
  
  <p><a href="https://i.stack.imgur.com/LomUN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/LomUN.png" alt="enter image description here"></a></p>