Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pressing Enter Key to Login in WPF windows.

I know that assigning the button to the AcceptButton property in a form would allow me to submit the form in Windows Forms. The problem I'm having is that I'm using a WPF Window as the login screen and I don't know how to make the button work when the Enter Key is pressed. There isn't an AcceptButton Property for WPF Windows. Any Help?

like image 821
Gawjus Gurl Avatar asked Jan 26 '14 08:01

Gawjus Gurl


1 Answers

Set IsDefault to True.

<Button IsDefault="True"/>

From MSDN:

Gets or sets a value that indicates whether a Button is the default button. A user invokes the default button by pressing the ENTER key.

like image 189
Rohit Vats Avatar answered Sep 29 '22 15:09

Rohit Vats