I have a custom control (MyControl
) that exposes a custom command. I want the parent Window
to be able to invoke this command, and all MyControls
should react to it.
I have added the command to MyControl
's CommandBindings
collection, which also provides a CanExecute
callback that always returns true.
My problem is that a menu item that invokes this command never gets enabled. I'm presuming this is because the menu is above the MyControls
in the visual tree, but to be honest I'm a little fuzzy on how RoutedUICommand
's scope works exactly.
Can someone clarify what I'm doing wrong, or if this is even possible?