How to make a submit button in WPF?

Jader Dias picture Jader Dias · Nov 16, 2010 · Viewed 38.7k times · Source

When you press Enter anywhere in a HTML form it triggers its action, that is equivalent of pressing the submit button. How to make a window that when I press Enter anywhere it will trigger an event?

Answer

Alex B picture Alex B · Nov 16, 2010

Set the IsDefault property on the button to true to enable the Enter key to activate that button's action. There is also the IsCancel property that does the same thing for the Escape key.