title: WPF: TabControl and dynamic TabItems
body: <p>I am trying to create a GUI for my current project using WPF in C#.
  I would like to have tabs (dynamically created at runtime) and each tab should open a table with the same column headers but different contents.</p>
  
  <p>I know I could realize tabs and tables like this:</p>
  
  <pre><code>&lt;Grid&gt;
      &lt;TabControl  x:Name="tabControl"  TabStripPlacement="Left"&gt;
          &lt;TabItem Header="Example 1" x:Name="tabItem" &gt;
              &lt;DataGrid ItemsSource="{Binding TagCollection.Tags}" AutoGenerateColumns="False"&gt;
                  &lt;DataGrid.Columns&gt;
                      &lt;DataGridTextColumn Header="Tag" Binding="{Binding Tag}" /&gt;
                      &lt;DataGridTextColumn Header="Description" Binding="{Binding Description}" /&gt;
                      &lt;DataGridTextColumn Header="Value" Binding="{Binding Value}" /&gt;                                              
                  &lt;/DataGrid.Columns&gt;
              &lt;/DataGrid&gt;
          &lt;/TabItem&gt;
          &lt;TabItem Header="Example 2" x:Name="tabItem1" &gt;
              &lt;DataGrid ItemsSource="{Binding TagCollection.Tags}" AutoGenerateColumns="False"&gt;
                  &lt;DataGrid.Columns&gt;
                      &lt;DataGridTextColumn Header="Tag" Binding="{Binding Tag}" /&gt;
                      &lt;DataGridTextColumn Header="Description" Binding="{Binding Description}" /&gt;
                      &lt;DataGridTextColumn Header="Value" Binding="{Binding Value}" /&gt;
                  &lt;/DataGrid.Columns&gt;
              &lt;/DataGrid&gt;
          &lt;/TabItem&gt;
  
      &lt;/TabControl&gt;
  
  &lt;/Grid&gt;
  </code></pre>
  
  <p>How can I produce a view like that with code behind? I am not used to Bindings and such things yet, so perhaps someone could show me a short example?</p>
  
  <p>Thanks
  KatZe</p>