title: Setting the style of a WPF UserControl
body: <p>I know I can set the style of a <code>UserControl</code> like so in the control by adding an attribute:</p>
  
  <pre><code>Style="{StaticResource MyStyle}"
  </code></pre>
  
  <p>And having a style in my <code>ResourceDictionary</code> that looks something like the following:</p>
  
  <pre><code>&lt;Style x:Key="MyStyle" TargetType="{x:Type UserControl}"&gt;
      &lt;Style.Resources&gt;
          &lt;Style TargetType="Label"&gt;
              &lt;!-- Label Setters --&gt;
          &lt;/Style&gt;
          &lt;Style TargetType="TextBox"&gt;
              &lt;!-- TextBox Setters --&gt;
          &lt;/Style&gt;
      &lt;/Style.Resources&gt;
  &lt;/Style&gt;
  </code></pre>
  
  <p>But is there a way I can set the style of the <code>UserControl</code> in the <code>ResourceDictionary</code> directly like:</p>
  
  <pre><code>&lt;Style x:Key="MyStyle" TargetType="{x:Type MyControl}"&gt;
  </code></pre>
  
  <p>Essentially my question is, can I apply the style directly to the control instead of to the controls components?</p>
  
  <p><strong>EDIT:</strong>
  What I am trying to accomplish is something like the following:</p>
  
  <pre><code>&lt;Style x:Key="MyStyle" TargetType="{x:Type MyControl}"&gt;
      &lt;Setter Property="Background" Value="Black"/&gt;
  &lt;/Style&gt;
  &lt;Style x:Key="{x:Type MyControl}" TargetType="{x:Type MyControl}" BasedOn="{StaticResource MyStyle}"/&gt;
  </code></pre>
  
  <p>Where the second line applies the style to all controls in the application, if you do something similar with a normal control this approach works.</p>
  
  <p>However this only sets the <code>Background</code> of the <code>UserControl</code>, so how can I apply that same background to its components.</p>
  
  <p>How can I do it with the <code>UserControl</code>?</p>