title: How to extend instead of overriding WPF Styles
body: <p>I want to use custom theme in my application and as far as I know I can accomplish this by using resource dictionary and referencing it in App.xaml. Styles would override the defaults like this:</p>
  
  <pre><code>&lt;Style TargetType="{x:Type Label"&gt;
      &lt;Setter Property="Foreground" Value="Green" /&gt;
  &lt;/Style&gt;
  </code></pre>
  
  <p>Now as I guess the default Label style is overriden with same values but all my label fonts are green. The problem starts when I want to style one label somewhere again. When I want to change some other property in my Grid like this</p>
  
  <pre><code>&lt;Grid.Resources&gt;
      &lt;Style TargetType="{x:Type Label"&gt;
          &lt;Setter Property="FontSize" Value="28" /&gt;
      &lt;/Style&gt;
  &lt;/Grid.Resources&gt;
  </code></pre>
  
  <p>All labels inside my grid are losing their foreground color and have default one again (didn't I override defaults in previous step?). After some tries I found out that to do this properly i have to add another property to <code>Style</code> declaration <code>BasedOn={StaticResource {x:Type Label}}"</code> and it works. This is kind of weird for me because now I will have to repeat same BasedOn code in whole app and this is not how styling works - this should be done automatically! For example in HTML + CSS styles are inherited and merged and in WPF they are replaced...</p>
  
  <p>Notice that when I don't use any styles controls still get their look from somehwere (System Themes?). How can I tell them to look for defaults somewhere else so without any additional code on styles they will think that they should be green by default?</p>
  
  <p>Is there any way I can automate setting BasedOn property? Or maybe there is a better to do this overally?</p>