-1

i want to capture key combination such as ALT+CTL+SPACE in my RichEdit control in WPF.

1 Answer 1

2

You can add PreviewKeydown event for RichTextBox.

PreviewKeyDown="TextBox_OnPreviewKeyDown" in xaml 

event handler in code behind as follows

private void TextBox_OnPreviewKeyDown(object sender, KeyEventArgs e)
{

    if (Keyboard.IsKeyDown(Key.LeftCtrl) && Keyboard.IsKeyDown(Key.LeftAlt) && 
        Keyboard.IsKeyDown(Key.Space))           
    {
        //  All keys were pressed
    } 
}

you can test when three keys are pressed.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.