title: How to add user control in tab control in WPF
body: <p>The below article shows how to create dynamic tabs in WPF, that in each tab it will add just one text box.</p>
  
  <pre><code>private TabItem AddTabItem()
  {
      int count = _tabItems.Count;
  
      // create new tab item
      TabItem tab = new TabItem();
  
      tab.Header = string.Format("Tab {0}", count);
      tab.Name = string.Format("tab{0}", count);
      tab.HeaderTemplate = tabDynamic.FindResource("TabHeader") as DataTemplate;
  
      tab.MouseDoubleClick += new MouseButtonEventHandler(tab_MouseDoubleClick);
  
      // add controls to tab item, this case I added just a textbox
      TextBox txt = new TextBox();
  
      txt.Name = "txt";
      tab.Content = txt;
      // insert tab item right before the last (+) tab item
      _tabItems.Insert(count - 1, tab);
  
      return tab;
  }
  </code></pre>
  
  <p><a href="http://www.codeproject.com/Articles/493538/Add-Remove-Tabs-Dynamically-in-WPF">http://www.codeproject.com/Articles/493538/Add-Remove-Tabs-Dynamically-in-WPF</a></p>
  
  <p>what can I do for adding some complex controls that their positions are fixed instead of just 1 text box? can I create a user control for this purpose? so how can I add the user control to tab control?</p>