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

So the command needs to be bound to a parent of the button.

If I find a fix for this I'll report it. If you know of one, I'd love to here about it.
Next
Reply
Map
View

Click here to load this message in the networking platform