title: TabItems from View collection
body: <p>I am using MVVM. I have a tab control. I will have a collection of items. I want to display each of this item in the collection as a tab item. The view in each tab item is different and may have its own viewmodel. How do I achieve this?
  E.g. I have 3 items in the collection. The Tab item template contains an ItemControl. I would like to now have 3 Tabs created and the ItemControls inside each tabitem may be showing different views.</p>
  
  <p>One way I could do is have a single view and viewmodel for each item. Now based on some condition the View will display different UI elements and behave differently. But I am afraid this will make the view quite complex over a period of time. </p>
  
  <p>Edit: Goblin's solution below works fine but I have an issue when a custom style applied to TabControl. </p>
  
  <pre><code>&lt;Style x:Key="TabControlStyle" TargetType="{x:Type TabControl}"&gt;
  &lt;Setter Property="Template"&gt;
    &lt;Setter.Value&gt;
       &lt;ControlTemplate TargetType="TabControl"&gt;
        &lt;Grid&gt;
           &lt;Grid.ColumnDefinitions&gt;
              &lt;ColumnDefinition/&gt; &lt;ColumnDefinition /&gt;
           &lt;/Grid.ColumnDefinitions&gt;
           &lt;Grid.RowDefinitions&gt;
              &lt;RowDefinition Height="Auto" Name="RowDefinition0" /&gt;
              &lt;RowDefinition Height="*" Name="RowDefinition1" /&gt;
           &lt;/Grid.RowDefinitions&gt;
           &lt;TabPanel Grid.Column="0" Grid.Row="0" /&gt;
           &lt;Border Grid.Column="0" Grid.Row="1"&gt;
               &lt;ContentPresenter Content="{TemplateBinding TabControl.SelectedContent}" ContentTemplate="{TemplateBinding TabControl.SelectedContentTemplate}" ContentStringFormat="{TemplateBinding TabControl.SelectedContentStringFormat}" ContentSource="SelectedContent" Name="PART_SelectedContentHost" Margin="{TemplateBinding Control.Padding}" SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}" /&gt;
            &lt;/Border&gt;
            &lt;/Grid&gt;
            &lt;ControlTemplate.Triggers&gt;
  </code></pre>
  
  <p>EDIT: This has been resolved by adding ContentTemplateSelector to the ContentPresenter in the above TabControl style</p>