示例#1
0
 private void InputBox_KeyUp(object sender, KeyEventArgs e)
 {
     if (e.Key == System.Windows.Input.Key.Enter)
     {
         if (sender is TextBox textBox)
         {
             var request = new TraversalRequest(FocusNavigationDirection.Next);
             textBox?.MoveFocus(request);
             e.Handled = true;
         }
         else if (sender is PasswordBox pwBox)
         {
             SubmitButton.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent));
             e.Handled = true;
         }
     }
 }