Ribbon application menu is sometimes grayed out

Feb 3, 2009 at 8:45 PM
Sometimes, all commands in my application menu appear grayed out. All of their CanExecute handlers are set to:

private
void RibbonCommand_CanExecute(object sender, CanExecuteRoutedEventArgs e)

{

e.CanExecute =

true;

 

}

When the menu is grayed out , all i need to do is click somewhere on the ribbon ( either a ribbon control or even an empty space) and the menu is enabled again.

Is there anything else , apart from CanExecute , that determines if a menu command is enabled?

Coordinator
Feb 4, 2009 at 2:50 AM
Hi Banko,

This sounds like it might be a Focus issue.  You can try some of the solutions presented in this thread and see if they work for you: http://www.codeplex.com/wpf/Thread/View.aspx?ThreadId=40319.  (Set FocusManager.IsFocusScope to true or call Focus() directly whenever the menu items are getting grayed out.)

Thanks,
Samantha