title: How to override a global style (that doesn't have an x:Key), or alternatively apply a named style to all type-targeted controls?
body: <p>I declared a style that I want to apply to ALL the buttons in the project, the style resides in the ResourceDictionary:</p>
  
  <pre><code>&lt;Style TargetType="StackPanel"&gt;
      &lt;Setter Property="Orientation" Value="Horizontal" /&gt;
      &lt;Setter Property="VerticalAlignment" Value="Center"/&gt;
      &lt;Setter Property="HorizontalAlignment" Value="Center"/&gt;
  &lt;/Style&gt;
  </code></pre>
  
  <p>Now, in some window, I want to inherit from this style but add a value:</p>
  
  <pre><code>&lt;Style TargetType="StackPanel"&gt; 
      &lt;Setter Property="Margin" Value="5"/&gt;
  &lt;/Style&gt;
  </code></pre>
  
  <p>The problem is that it doesn't inherit from the global style, in order to inherit I have to assign a key to the global style:</p>
  
  <pre><code>&lt;Style TargetType="StackPanel" x:Key="StackPanelStyle" /&gt;
  </code></pre>
  
  <p>And then in the window's XAML inherit (or/and override - optional) it:</p>
  
  <pre><code>&lt;Style TargetType="StackPanel" BasedOn="StackPanelStyle" /&gt;
  </code></pre>
  
  <p>The problem is that if you assign a key, it's not global and you have to call it on each window/scope.</p>
  
  <p><strong>A solution to my question should be one of the two</strong> (is there anything else I am missing out?):</p>
  
  <ol>
  <li>Have a global style with a key, that is automatically applied to all its targeted controls in the entire application.</li>
  <li>A way to refer to the ResourceDictionary-level unnamed style without and override it.</li>
  </ol>
  
  <p>I thought about redeclaring the styles near the named styles (in the ResourceDictionary) which actually works:</p>
  
  <pre><code>&lt;!--In the ResourceDictionary--&gt;
  &lt;Style x:Key="StackPanelStyle" TargetType="StackPanel"&gt;
      &lt;Setter Property="Orientation" Value="Horizontal" /&gt;
      &lt;Setter Property="VerticalAlignment" Value="Center"/&gt;
      &lt;Setter Property="HorizontalAlignment" Value="Center"/&gt;
  &lt;/Style&gt;
  &lt;!--In the app.xaml--&gt;
  &lt;Style TargetType="StackPanel" BasedOn="{StaticResource StackPanelStyle}"/&gt;
  &lt;!--In the window/page scope--&gt;
  &lt;Style TargetType="StackPanel" BasedOn="{StaticResource StackPanelStyle}"/
  </code></pre>
  
  <p>But I am looking for better stuff than stupidly redeclare all the styles.</p>