Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
CommandRouting using a button.
Message
From
11/04/2008 04:58:15
 
 
To
10/04/2008 15:26:34
General information
Forum:
ASP.NET
Category:
Windows Presentation Foundation (WPF)
Miscellaneous
Thread ID:
01309791
Message ID:
01309897
Views:
13
>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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform