How to select a TabItem based off of it's Header
问题 In my program I have a tabItem that gets selected when a TreeViewItem with an equivalent header is selected. This is what I currently have (It works): (parent_TreeViewItem.Items.Contains(SelectedItem)) { tabControl1.SelectedItem = tabControl1.Items //Changes tab according to TreeView .OfType<TabItem>().SingleOrDefault(n => n.Header.ToString() == SelectedItem.Header.ToString()); } The difference with what I'm doing this time is that the tabItem 's header that I'm selecting is composed of a