private async void OnRename() { TextInputBox.SelectAll(); int count = 0; // try to get element focus while (!TextInputBox.Focus() && ++count < 20) { await Task.Delay(1); } }
private async void UserControl_Loaded(object sender, RoutedEventArgs e) { await Task.Delay(200); if (_passwordInput) { PasswordInputBox.Focus(); } else { TextInputBox.Focus(); } }