tags:

views:

682

answers:

1
+1  Q: 

WPF input gesture

Hi

I am working a WPF application, where I have maintained a Menu Bar with Input Gestures i.e keyboard Shortcuts.

For Save As menu item, I have kept Ctrl+A as per User's requirement. It works fine as far as the focus is on the main window.

Now my problem is, suppose use has navigated in some Listbox in window, and if he presses Ctrl+A, then Select All functionality takes places for the list box and Save As dialog box does not get called (as i have done the command binding for this input gesture)

Any idea how can I avoid this? and yes, I can not change my input gesture. It has to be Ctrl+A. :)

Thanks

+1  A: 

I think you could change the command bindings on the list box object to remove the binding for the command. Look at the ListBox.CommandBindings list.

You could also turn off Focusable on the ListBox so that it never receives keyboard commands.

You could also check out the eventing model. You could probably catch the keydown as the preview events "bubble up" from the root of the logical tree and then they are passed down from the end element down. They can be marked as handled on the way up or the way back down.

Lone Coder