CanExecute is not fired!

Docking/MDI for WPF Forum

Posted 15 years ago by Willie
Version: 4.5.0486
I have an application with a toolbox on the left (mditabbed).
On the right is a documentwindow.

If I now close the (last) documentwindow the ribbonbarmenu items are disabled. My Menu contains a New which is always enabled (e.CanExecute=True), but it is disabled???

When I now click on the left toolbox and after that open the menu, the New is Enabled.

While debugging I can see that the CanExecute function is not triggered.

Seems there is a focus problem with the ribbonbar.

[Modified at 04/15/2009 01:32 AM]

Comments (2)

Posted 15 years ago by Willie
It looks like this has to do with the focusable.
If i select an item from a dropdown combobox in the ribbonbar which changes properties so that some ribbonbar CanExecutes would change their state,

this only happens when i click on the documentwindow.

As long as I do nothing it looks like the focus which is still at the dropdown combo forces the system to not update the ribbonbar until i click on the documentwindow.
Posted 15 years ago by Actipro Software Support - Cleveland, OH, USA

You are running into a common scenario with how WPF manages command routing in relation to focus. This really has nothing to do with our controls and is a general WPF behavior.

You could repro this same scenario without using our controls and having a control with focus at the similar level of the Toolbox be removed.

What happens is the keyboard focus moves to a level above which the Toolbox checks and therefore the Toolbox probably doesn't find valid command handlers. You can Google and find lots of information on how command routing works in WPF, and that should be able to help you more.

Actipro Software Support

The latest build of this product (v24.1.2) 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.