WPF Command CanExecute event doesn't fire unless RibbonGroup dropdown is open

448 Views Asked by At

I have about 5 RibbonGroups inside a RibbonTab and each ribbon group contains about 3-5 commands. To fit everything on screen, WPF Ribbon control automatically collapse few RibbonGroups into dropdown menus. Nothing special till here.

Now I see that the CanExecute events of commands inside the collapsed RibbonGroups doesn't fire until the dropdown is opened first time. (This might be to improve the performance - i.e. unless any command is visible, whats the need to fire CanExecute!?)

In my application, the logic is such that if none of the commands are enabled (i.e. CanExecute is false) in a RibbonGroup, then we hide that RibbonGroup. But unless all CanExecutes are fired, I won't know how many (or all) commands are enabled.

Is this a limitation of RibbonGroup or is this behavior by design? Is there any workaround to manually execute all the CanExecutes, at least once, regardless of whether the commands are in collapsed RibbonGroup or not.

BTW, CommandManager.InvalidateRequerySuggested() also doesn't help here.

1

There are 1 best solutions below

1
On

RibbonControls was found to be a very glucky library. Consider moving to Fluent Ribbon Control Suite