Skip to content
Discussion options

You must be logged in to vote

Yes, you can. In the WindowsDialog.xaml, whatever you named it, add a PreviewKeyDown event, and the function will look like this.

'''
private void WindowsDialog_PreviewKeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.Enter)
{
// This line prevents the default behavior of the event from occurring.
// It is commonly used to suppress or handle specific input events, such as invalid characters.
e.Handled = true;
}
}
'''

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Mithicor
Comment options

Answer selected by Mithicor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants