title: WPF Style Inheritance
body: <p>I have this XAML. If I remove the StackPanel.Resources section I get the styles that were defined at the application level. If I leave it in, then I only get the new styles.</p>
  
  <p>How to I make it combine both the local and global styles?</p>
  
  <pre><code>&lt;Window x:Class="MainWindow"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      Title="MainWindow" Height="350" Width="525"&gt;
  
      &lt;DockPanel&gt;
          &lt;StackPanel DockPanel.Dock="Top" Orientation="Horizontal" &gt;
              &lt;StackPanel.Resources&gt;
                  &lt;Style TargetType="TextBlock" &gt;
                      &lt;Setter Property="Margin" Value="4" /&gt;
                  &lt;/Style&gt;
                  &lt;Style TargetType="Button" &gt;
                      &lt;Setter Property="Margin" Value="4" /&gt;
                  &lt;/Style&gt;
              &lt;/StackPanel.Resources&gt;
              &lt;Border Padding="5" BorderBrush="Blue" BorderThickness="4" &gt;
                  &lt;StackPanel&gt;
                      &lt;TextBlock&gt;Applications&lt;/TextBlock&gt;
                      &lt;Button&gt;Open Issues&lt;/Button&gt;
                      &lt;Button&gt;Services&lt;/Button&gt;
                  &lt;/StackPanel&gt;
              &lt;/Border&gt;
          &lt;/StackPanel&gt;
          &lt;StackPanel&gt;&lt;/StackPanel&gt;
      &lt;/DockPanel&gt;
  &lt;/Window&gt;
  </code></pre>
  
  <p>In case it helps, this is how I defined the globla styles.</p>
  
  <pre><code>&lt;Application x:Class="Application"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      StartupUri="MainWindow.xaml"&gt;
      &lt;Application.Resources&gt;
          &lt;ResourceDictionary Source="ShinyBlue.xaml"/&gt;
      &lt;/Application.Resources&gt;
  &lt;/Application&gt;
  </code></pre>