I want to execute a delete command like this:
ApplicationCommands.Delete.Execute(Keyboard.FocusedElement, Keyboard.FocusedElement);
But:
ApplicationCommands.Delete.CanExecute(Keyboard.FocusedElement, Keyboard.FocusedElement)
is false, so it’s not executed.
How can I change it to be true?
I believe you need to set up
CommandBindings that specify what happens when the Execute and CanExecute functions are called.Here’s an example:
That example comes from the CommandBinding documentation (slightly modified).