How to set the focus on an TextBox element in WPF
TextBox
I have this code:
txtCompanyID.Focusable = true; txtCompanyID.Focus();
In Code behind you can achieve it only by doing this.
private void Window_Loaded(object sender, RoutedEventArgs e) { txtIndex.Focusable = true; txtIndex.Focus(); }
Note: It wont work before window is loaded