EDN Admin
Well-known member
I have a button on a WPF window that, when clicked, opens up a dialog window where I need to get some text from the user. If I tab to the button, so it has focus, and then hit the Enter key, it opens up the dialog window and gives it the enter key to handle (which of course ends the dialog window).
How do I handle the Enter key in the button, and get rid of it before going to the dialog window? Ive tried the KeyDown and KeyUp events but they arent being triggered. Ive tried the PreviewKeyDown event, but the enter key goes to the Dialog window, comes back, and THEN goes into the PreviewKeyDown event code (ie, too late).
How can I stop the enter key from being passed into the dialog window?
View the full article
How do I handle the Enter key in the button, and get rid of it before going to the dialog window? Ive tried the KeyDown and KeyUp events but they arent being triggered. Ive tried the PreviewKeyDown event, but the enter key goes to the Dialog window, comes back, and THEN goes into the PreviewKeyDown event code (ie, too late).
How can I stop the enter key from being passed into the dialog window?
View the full article