title: How can data templates in generic.xaml get applied automatically?
body: <p>I have a custom control that has a ContentPresenter that will have an arbitrary object set as it content. This object does not have any constraint on its type, so I want this control to display its content based on any data templates defined by application or by data templates defined in Generic.xaml. If in a application I define some data template(without a key because I want it to be applied automatically to objects of that type) and I use the custom control bound to an object of that type, the data template gets applied automatically. But I have some data templates defined for some types in the generic.xaml where I define the custom control style, and these templates are not getting applied automatically. Here is the generic.xaml :</p>
  
  <pre><code>&lt;DataTemplate DataType="{x:Type PredefinedType&gt;
      &lt;!-- template definition --&gt;
  &lt;DataTemplate&gt;
  
  &lt;Style TargetType="{x:Type CustomControl}"&gt;
      &lt;!-- control style --&gt;
  &lt;/Style&gt;
  </code></pre>
  
  <p>If I set an object of type 'PredefinedType' as the content in the contentpresenter, the data template does not get applied. However, If it works if I define the data template in the app.xaml for the application thats using the custom control.</p>
  
  <p>Does someone got a clue? I really cant assume that the user of the control will define this data template, so I need some way to tie it up with the custom control. </p>