private void OnKeyDownHandler(object sender, KeyEventArgs e) { if (e.Key == Key.Return) { textBlock1.Text = "You Entered: " + textBox1.Text; } } If the key that is pressed is the Enter key, a message is displayed in the TextBlock.