The WPF TextBox captures Ctrl-Z and Ctrl-Y for its own undo/redo. Normally great, but in our app we have some text boxes that I don't want to have this behavior, but to instead pass through to the overall app to handle as global undo.
I figured out I can override the text boxes' handling of these by adding CommandBindings for ApplicationCommands.Undo/Redo.
My question: how can I 'forward' those bindings to the parent framework element so that it eventually routes to the app's handler I installed on the main window?
Update: Thanks to AndrewS it turns out all I needed was to set IsUndoEnabled to false. Then the app commands get ignored and the top level window can handle them. Yay!
You have to register a KeyBinding for the shortcut and associated it with the ApplicationCommands.NotACommand. e.g.
<TextBox>
<TextBox.InputBindings>
<KeyBinding Key="Y" Modifiers="Control" Command="NotACommand" />
<KeyBinding Key="Z" Modifiers="Control" Command="NotACommand" />
</TextBox.InputBindings>
</TextBox>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With