What\'s the best way to catch the return key in a PasswordBox? (WPF/XAML)
I have a TextBox field and a PasswordBox field on my login form (for username and password en
You can handle the KeyDown event on the PasswordBox (and TextBox if desired) and then use the following event handler --
private void OnKeyDown(object sender, KeyEventArgs e) { if (e.Key != Key.Return && e.Key != Key.Enter) return; e.Handled = true; HandleEnter(); }