How can I make a specific TabItem gain focus on a TabControl without click event?
问题 How can I tell my TabControl to set the focus to its first TabItem, something like this: PSEUDO-CODE: ((TabItem)(MainTabControl.Children[0])).SetFocus(); 回答1: How about this? MainTabControl.SelectedIndex = 0; 回答2: this.tabControl1.SelectedTab = this.tabControl1.TabPages["tSummary"]; I've found it's usually a best practice to name your tabs and access it via the name so that if/when other people (or you) add to or subtact tabs as part of updating, you don't have to go through your code and