microsoft / XamlBehaviorsWpf

Home for WPF XAML Behaviors on GitHub.
MIT License
852 stars 140 forks source link

KeyTrigger doesn't invoke the command using "ALT" Modifier Key #175

Closed salvatorefrancostats closed 2 months ago

salvatorefrancostats commented 2 months ago

Describe the bug Keytriggers with modifier "ALT" doesn't invoke the command

To Reproduce Steps to reproduce the behavior:

  1. Create a WPF Application
  2. Create MainWindow
  3. Add a keytrigger with Key="Up" and Modifiers="Alt"
  4. Add an InvokeCommandAction and bind Command1
  5. Add breakpoints on Command1
  6. Run the application
  7. Press Alt+Up on the keyboard

Current behavior Command1 won't be fired Expected behavior Command1 will be fired

Screenshots image

Desktop (please complete the following information):

brianlagunas commented 2 months ago

Please create a simple reproduction app.

salvatorefrancostats commented 2 months ago

Hi, here is a very simple WPF App, using ALT+ArrowDown the command won't be triggered, if you will change it using CTRL as a modifier it will work.

Hope it helps [WpfApp1.zip](https://github.com/user-attachments/files/16725722/WpfApp1.zip)

brianlagunas commented 2 months ago

It appears that WPF is seeing the Alt key as the System key AND the Modifier key, so the Down key is never registered. This should be an easy fix.