title: DataTemplate for each DataType in a GridViewColumn CellTemplate
body: <p>I have an ObservableCollection which contains view models of multiple types, and I would like to make a DataTemplate for each type within each of my GridViewColumn's CellTemplates.  In this simple example I could create a base ViewModel, but I would like to be able to do this just from xaml.  The xaml below shows what I am trying to do, where one of the DataTemplates would be used for each CellTemplate.</p>
  
  <p>If there were a GridViewColumn.Resources I would define the DataTemplates there then use a a DataTemplate with ContentPresenter in the CellTemplate, but I obviously can't do that.  I'm thinking I may need a TemplateSelector, but I'm not sure where to start.</p>
  
  <pre><code>&lt;ListView ItemsSource={Binding GenericObservableCollection&gt;
      &lt;ListView.View&gt;
          &lt;GridView&gt;
              &lt;GridViewColumn Header="Type"&gt;
                  &lt;GridViewColumn.CellTemplate&gt;
                      &lt;DataTemplate DataType="{x:Type vm:ActionInputViewModel}"&gt;
                          &lt;TextBlock Text="Input"/&gt;
                      &lt;/DataTemplate&gt;
                      &lt;DataTemplate DataType="{x:Type vm:ActionOutputViewModel}"&gt;
                          &lt;TextBlock Text="Output"/&gt;
                      &lt;/DataTemplate&gt;
                  &lt;/GridViewColumn.CellTemplate&gt;
              &lt;/GridViewColumn&gt;
              &lt;GridViewColumn Header="Value"&gt;
                  &lt;GridViewColumn.CellTemplate&gt;
                      &lt;DataTemplate DataType="{x:Type vm:ActionInputViewModel}"&gt;
                          &lt;TextBlock Text="{Binding Property1}"/&gt;
                      &lt;/DataTemplate&gt;
                      &lt;DataTemplate DataType="{x:Type vm:ActionOutputViewModel}"&gt;
                          &lt;TextBlock Text="{Binding Property2}"/&gt;
                      &lt;/DataTemplate&gt;
                  &lt;/GridViewColumn.CellTemplate&gt;
              &lt;/GridViewColumn&gt;
          &lt;/GridView&gt;
      &lt;/ListView.View&gt;
  &lt;/ListView&gt;
  </code></pre>