问题
I have a main window with some keybindings like this:
<Window.InputBindings>
<KeyBinding Command="{Binding RotateCommand}"
CommandParameter="left"
Key="L">
</KeyBinding>
<KeyBinding Command="{Binding RotateCommand}"
CommandParameter="right"
Key="R" />
</Window.InputBindings>
The problem is that I am unable to type this letters in any textboxes in that window, keys L and R just call commands.
Is there any way to disable KeyBindings inside of some controls? (Maybe when some controls have a focus).
I search through the internet and find this, but I can't get access to CanExecute routed event because I'm using mvvm
model for command bindings.
来源:https://stackoverflow.com/questions/28393307/disabling-global-keybindings-in-some-controls-in-wpf-c-sharp