Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
CommandRouting using a button.
Message
De
11/04/2008 04:58:15
 
 
À
10/04/2008 15:26:34
Information générale
Forum:
ASP.NET
Catégorie:
Windows Presentation Foundation (WPF)
Divers
Thread ID:
01309791
Message ID:
01309897
Vues:
12
>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform