Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I ensure that only one KeyBinding command is executed when a keyboard shortcut is used?

I have the following KeyBindings:

<KeyBinding Gesture="Ctrl+S" Command="Save" />
<KeyBinding Gesture="Ctrl+Shift+S" Command="SaveAs" />

When I press Ctrl+Shift+S to execute the SaveAs command, it works -- but directly afterwards, the Save command is also executed. Is this caused by my Gesture definitions?

like image 798
Showtime Avatar asked Apr 10 '12 17:04

Showtime


1 Answers

You have to mark the RoutedEvent as Handled=true using the RoutedEventArgs parameter in your method that handles the save.

like image 63
Jf Beaulac Avatar answered Sep 27 '22 20:09

Jf Beaulac