Question

CommandBindings

Posted 8 years ago by Avatar MichaelEhlert - Boll und Partner Software GmbH
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 8 years ago by Actipro Software Support - Cleveland, OH, USA
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 8 years ago by MichaelEhlert - Boll und Partner Software GmbH
Great! Works as expected.
Information The latest build of this product (2014.2 build 0611) was released 6 days ago, which was after the last post in this thread.

Add a Comment

Please log in to a validated account to post comments.