I would like to have a button that switches a tab control to a specific tab item and afterwards set a focus on a textbox within that tab item.
For this I have an event handler for the click event like this
private void MyButton_Click(object sender, RoutedEventArgs e)
{
MyTabControl.SelectedIndex = 0;
MyTextBox.Focus();
}
This does not work, the tab item is changed but the text box remains without focus. How to do this?
Call UpdateLayout before focusing the textbox: