title: Set style for custom control
body: <p>I'm trying to create a custom user control. I've created ResourceDictionary file (Themes\Generic.xaml) with two styles:</p>
  
  <pre><code>&lt;ResourceDictionary
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:my="http://schemas.microsoft.com/wpf/2008/toolkit"
      xmlns:themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero"
      xmlns:components="clr-namespace:ORPO.WPF.Components"&gt;
  
      &lt;Style TargetType="{x:Type components:HeaderFilterDataGrid}" BasedOn="{StaticResource {x:Type DataGrid}}"&gt;
          ...
      &lt;/Style&gt;
      &lt;Style TargetType="{x:Type DataGridColumnHeader}"&gt;
          ...
      &lt;/Style&gt;
  &lt;/ResourceDictionary&gt;
  </code></pre>
  
  <p>and my custom control class:</p>
  
  <pre><code>public class HeaderFilterDataGrid : DataGrid
      {
  ...
  static HeaderFilterDataGrid()
          {
              DefaultStyleKeyProperty.OverrideMetadata(typeof(HeaderFilterDataGrid),
  new FrameworkPropertyMetadata(typeof(HeaderFilterDataGrid)));            
          }
  ...
  }
  </code></pre>
  
  <p>It works fine when I apply first style</p>
  
  <pre><code>DefaultStyleKeyProperty.OverrideMetadata(typeof(HeaderFilterDataGrid),
      new FrameworkPropertyMetadata(typeof(HeaderFilterDataGrid)));   
  </code></pre>
  
  <p>How can i apply second style for my custom control?
  I need both styles to be applied at the same time.</p>