What I want to do in this example is make the first tab of the tabcontrol disappear and add 2 new tabs dynamically. The new tabs appear but their 'Header' is not showing:
ItemCollection ic = this.tabControl1.Items;
TabItem firstTab = (TabItem)ic[0];
firstTab.Visibility = Visibility.Collapsed;
TabItem newTab = new TabItem();
newTab.HeaderTemplate = firstTab.HeaderTemplate;
newTab.Header = newTab.Name = "test1";
ic.Add(new TabItem());
newTab = new TabItem();
newTab.HeaderTemplate = firstTab.HeaderTemplate;
newTab.Template = firstTab.Template;
newTab.ContentTemplate = firstTab.ContentTemplate;
newTab.Header = newTab.Name = "test2";
ic.Add(new TabItem());