>Thought I'd post this just in case someone else comes across this problem:
>
>
><Button Command="ApplicationCommands.Save">Apply</Button>
>
>
>This works as expected if the button is on a toolbar or the command is on a menu item.
>
>But if it's just a button on a form the command binding:
>
>
>CommandBinding SaveCmdBinding = new CommandBinding(ApplicationCommands.Save,
> SaveCmdExecuted,
> SaveCmdCanExecute);
>CommandBindings.Add(SaveCmdBinding);
>
>
>Only appears to walk the visual tree of the button and not the visual tree of the item with focus. Setting Focusable="False" on the button doesn't fix this :(
Hi,
I tried testing this. AFAICS the button, whether in a toolbar or on the form, gets focus before the commands are handled - i.e. no difference in behaviour.
>So the command needs to be bound to a parent of the button.
Again it seems to work the same for me whether I add the binding to the button or the form.
Or am I misunderstanding your post?
Regards,
Viv