Get MenuItem from UIExtensionSites

Topics: CAB & Smart Client Software Factory
Mar 6, 2007 at 9:54 AM

I am adding ToolStripMenuItems to WorkItem.UIExtensionSites at runtime.
Based on the active Workitem view I need to enable or disable some of thows menu items.
How can I get the reference to added ToolStripMenuItems through WorkItem ?

Mar 6, 2007 at 5:20 PM
I am assuming that each of those ToolStripMenuItems you want to disable are binded to a Command, am I right? There is actually a way to disable a Command, and CAB has adapters that get notified when a command is disabled, and change the Enabled property on the invoker’s ToolStripItem to false.
So this is what you should do when a workitem becomes activated:
WorkItem.Commands“MyCommandName”.Status = CommandStatus.Disabled (or Enabled)
This will automatically disable (or enable) your MenuStripItem besides just disabling (or enabling) the command.

Let me know if this helps
Julian Dominguez
Mar 9, 2007 at 8:37 AM
that is exactly what I was looking for.

Thanks a lot!

Apr 13, 2007 at 10:30 AM
And what if I want to check or uncheck my menu items ?
Would it be nice to get the MenuItem from the UIExtensionSite at runtime to change such properties.

Apr 13, 2007 at 3:01 PM
OK I've found the answer in an earlier thread.