Jonathan Allen
Jonathan Allen

Reputation: 70307

WPF: Detect the shift button

This code should fire when is pressed, but not +. What change do I need to make it work correctly?

Private Sub cmdDeleteRow_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Input.KeyEventArgs)
    If e.Key = Input.Key.Tab Then
        'DO stuff
    End If
End Sub

Upvotes: 1

Views: 623

Answers (1)

Marko
Marko

Reputation: 2365

Hmh, yor question title doesn't match the content (no reference to the shift key)!

Are you trying to avoid "Do stuff" when Shift+Tab is pressed? If so you need to check the modifier keys, whether Shift is pressed or not. I don't know the exact code for vb.net (you can easily google for it), but in c# there's a Keyboard.Modifiers property that can be accessed...

Upvotes: 2

Related Questions