How can I make a specific TabItem gain focus on a TabControl without click event?

Edward Tanguay picture Edward Tanguay · Aug 4, 2009 · Viewed 44.1k times · Source

How can I tell my TabControl to set the focus to its first TabItem, something like this:

PSEUDO-CODE:

((TabItem)(MainTabControl.Children[0])).SetFocus();

Answer

Martin Liversage picture Martin Liversage · Aug 4, 2009

How about this?

MainTabControl.SelectedIndex = 0;