Determining the Enter key is pressed in a TextBox

前端 未结 5 1334
无人共我
无人共我 2021-02-02 07:08

Consider a XAML TextBox in Win Phone 7.

  

The goal here is that when the user presses the Enter

5条回答
  •  情话喂你
    2021-02-02 07:14

    If you are using the emulator, you can also do something like this to detect the enter key from your physical keyboard.

        private void textBox1_KeyUp(object sender, KeyEventArgs e) {
            var isEnterKey =
                e.Key == System.Windows.Input.Key.Enter ||
                e.PlatformKeyCode == 10;
    
            if (isEnterKey) {
                // ...
            }
        }
    

提交回复
热议问题