public void AddItem(TabViewModel sender) { TabViewModel newTabItem = new TabViewModel(this); newTabItem.Header = "New Tab"; newTabItem.IsSelected = true; if (sender != null) { int insertIndex = this.Tabs.IndexOf(sender) + 1; this.Tabs.Insert(insertIndex, newTabItem); } else { this.Tabs.Add(newTabItem); } }
public void RemoveItem(TabViewModel tabItem) { this.Tabs.Remove(tabItem); tabItem.Dispose(); }