Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

KeyDown EventHandler ignored when pressing 'Enter'

$
0
0
I am trying to display a MessageBox when the user presses enter on the keyboard, but the event does not seem to fire for the Enter-key? It works with other keys but not with enter...how to solve?
private void richTextBox1_KeyDown(object sender, KeyEventArgs e)
{
    if (e.Key == Key.Return)
     MessageBox.Show("");
}
<RichTextBox Name="richTextBox1" KeyDown="richTextBox1_KeyDown"....>

Viewing all articles
Browse latest Browse all 18858

Trending Articles