WPF: A TextBox that has an event that fires when the Enter Key is pressed

后端 未结 5 1756
走了就别回头了
走了就别回头了 2021-01-30 18:10

Instead of attaching a PreviewKeyUp event with each TextBox in my app and checking if the pressed key was an Enter key and then do an action, I decided

5条回答
  •  南笙
    南笙 (楼主)
    2021-01-30 18:43

    add event in xaml to the specific textbox or object:

    KeyDown="txtBarcode_KeyDown"

提交回复
热议问题