title: How can you enable auto-DataTemplate selection based on data type like you can with an items control?
body: <p>We're writing a very specialized <code>ItemsControl</code> which actually has three <code>ContentPresenter</code>'s per 'row', each bound to a different object (think poor-man's grid) instead of the more common one, like a <code>ListBox</code>.</p>
  
  <p>Now with a <code>ListBox</code> if you don't explicitly specify either an <code>ItemTemplate</code> or an <code>ItemTemplateSelector</code>, there seems to be some internal selector that applies the template based purely on data type.  However, our <code>ContentPresenter</code>'s aren't picking them up.  We've also tried switching them to <code>ContentControl</code>'s instead, but that hasn't worked either.</p>
  
  <p>Now I know I can simply write my own <code>DataTypeTemplateSelector</code> that does this, but I'm wondering if that functionality is already 'baked in' somewhere considered its used with so many <code>ItemsControl</code>'s (<code>ListBox</code>, <code>TreeView</code>, <code>ComboBox</code>', <code>DataGrid</code>, etc.) and according to this MSDN article...</p>
  
  <p><a href="http://msdn.microsoft.com/en-us/library/ms742521.aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/library/ms742521.aspx</a></p>
  
  <p>...it should work by default!  But again, it doesn't.</p>
  
  <p>Here's our (pseudo) code...</p>
  
  <pre><code>&lt;UserControl.Resources&gt;
  
      &lt;!-- These all work when the relevant items are in a ListBox,
           but not with stand-alone ContentPresenters or ContentControls --&gt;
  
      &lt;DataTemplate DataType="local:SomeTypeA"&gt;
          &lt;TextBlock Text="{Binding Converter={c:DataTypeNameConverter}}" Foreground="Blue" /&gt;
      &lt;/DataTemplate&gt;
  
      &lt;DataTemplate DataType="local::SomeTypeB"&gt;
          &lt;TextBlock Text="{Binding Converter={c:DataTypeNameConverter}}" Foreground="Purple" /&gt;
      &lt;/DataTemplate&gt;
  
      &lt;DataTemplate DataType="local::SomeTypeC"&gt;
          &lt;TextBlock Text="{Binding Converter={c:DataTypeNameConverter}}" Foreground="Purple" /&gt;
      &lt;/DataTemplate&gt;
  
  &lt;/UserControl.Resources&gt;
  
  &lt;!-- These don't pick up the templates --&gt;
  &lt;ContentControl Content="{Binding Field1}" /&gt;
  &lt;ContentPresenter Content="{Binding Field2}" /&gt;
  
  &lt;!-- This however does --&gt;
  &lt;ListBox ItemsSource="{Binding AllItems}" 
  </code></pre>
  
  <p>So... anyone want to take a stab at why not?</p>