Determining the Enter key is pressed in a TextBox

前端 未结 5 1335
无人共我
无人共我 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:18

    A straight forward approach for this in a textbox is

    private void textBox1_KeyDown(object sender, KeyEventArgs e)
    {
        if (e.Key == Key.Enter)
        {
            Debug.WriteLine("Enter");
        }
    }
    

提交回复
热议问题