title: DependencyProperty of type Style in custom control
body: <p>In a custom control I'd like to use a Style (given as DependencyProperty) for a TextBlock in my Template.</p>
  
  <p>MyControl.cs</p>
  
  <pre><code>public static DependencyProperty HeadingStyleProperty =
      DependencyProperty.Register("HeadingStyle",
                                  typeof (Style),
                                  typeof (MyControlElement),
                                  new PropertyMetadata(new Style(typeof(TextBlock))));
  
  public Style HeadingStyle {
      get { return (Style) GetValue(HeadingStyleProperty); }
      set { SetValue(HeadingStyleProperty, value); }
  }
  </code></pre>
  
  <p>MyControl.xaml</p>
  
  <pre><code>&lt;ResourceDictionary ...&gt;
      &lt;Style TargetType="local:MyControl"&gt;
          &lt;Style.Resources&gt;
              &lt;!-- Getting error on BasedOn="TemplateBinding --&gt;
              &lt;Style TargetType="TextBlock" BasedOn="{TemplateBinding HeadingStyle}" x:Key="Heading" /&gt;
          &lt;/Style.Resources&gt;
          &lt;Setter Property="Template"&gt;
              &lt;Setter.Value&gt;
                  &lt;ControlTemplate&gt;
                      &lt;TextBlock Style="{StaticResource Heading}" Text="StyledHeading" /&gt;
                  &lt;/ControlTemplate&gt;
              &lt;/Setter.Value&gt;
          &lt;/Setter&gt;
      &lt;/Style&gt;
  &lt;/ResourceDictionary&gt;
  </code></pre>
  
  <p>I get compiler error 'HeadingStyle' member is not valid because it does not have a qualifying type name. </p>
  
  <p>Do I have to modify the DataType of my DP from Style to a more specific one? Or what causes this error. The initial value of DP is set to Style for TargetType TextBlock...</p>