title: DataTemplateSelector in WPF
body: <p>I want to switch between two views that have different bindings and controls. Can I do this using DataTemplateSelector?</p>
  
  <pre><code>&lt;TabControl
          ItemsSource="{Binding Items}" SelectedIndex="{Binding SelectedTabIndex, Mode=TwoWay}"&gt;
          &lt;TabControl.ItemTemplate&gt;
              &lt;DataTemplate&gt;
                  &lt;DockPanel&gt;
                      &lt;TextBlock Text="{Binding TabName}"&gt;&lt;TextBlock.Background&gt;&lt;SolidColorBrush /&gt;&lt;/TextBlock.Background&gt;&lt;/TextBlock&gt;
                      &lt;Button Name="btnDelete" DockPanel.Dock="Right" Margin="5,0,0,0" Padding="0"  CommandParameter="{Binding RelativeSource={RelativeSource AncestorType={x:Type TabItem}}, Path=Name}" BorderBrush="#00000000"&gt;
                          &lt;Image Source="/WPF_AccApp;component/Images/11.gif" Height="11" Width="11"&gt;&lt;/Image&gt;
                      &lt;/Button&gt;
                      &lt;DockPanel.Background&gt;
                          &lt;SolidColorBrush /&gt;
                      &lt;/DockPanel.Background&gt;
                  &lt;/DockPanel&gt;
              &lt;/DataTemplate&gt;
          &lt;/TabControl.ItemTemplate&gt;
                  &lt;DataTemplate&gt;
                          &lt;y:TabView /&gt; //Here I want to have two diferent views
                      &lt;/DataTemplate&gt;
              &lt;/TabControl&gt;
  </code></pre>