CommandBindings

Ribbon for WPF Forum

Posted 17 years ago by MichaelEhlert - Boll und Partner Software GmbH
Version: 1.0.0345
Avatar
Hi everybody,
i have a application command that should do some action on the actual uielement of my page. I also have an input gesture for that command. The canexecute method looks somewhat like

e.CanExecute = false;
object o = Keyboard.FocusedElement;
if (o != null)
{
if (o is TextBox)
{
...
e.CanExecute = true;

This is working fine, until i click on a minimized ribbon. If i do so, there are two calls for canexecute, first call retrieves the right uielement, for the second call Keyboard.FocusedElement is null.

There seems to be a solution for that, because the integrated ApplicationCommands (like Undo, Cut,..) are working as expected.


Michael

Comments (2)

Posted 17 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Michael,

With controls you generally handle the command within the control itself. So TextBoxes process the CanExecute of EditingCommands when focus is within the TextBox. That is how we set up our sample too. You can see our RichTextBoxExtended handles a number of custom commands and supplies the proper CanExecute when the RichTextBoxExtended has focus.

If that doesn't help, then perhaps make a tiny sample that shows the problem and email that over and we can have a look.


Actipro Software Support

Posted 17 years ago by MichaelEhlert - Boll und Partner Software GmbH
Avatar
Great! Works as expected.
The latest build of this product (v24.1.1) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.