Accessing buttons added to a UIExtensionSite

Topics: CAB & Smart Client Software Factory
Sep 14, 2006 at 10:31 PM
originally posted by: MichaelDaniel

Hi.
I have added several buttons dynamically to a shell ToolStrip from my ModuleController.
I can access the button's Status (eg Disabled/Enabled) through the CommandStatus. For example:

WorkItem.Commands"MyButton".Status = CommandStatus.Disabled;

However, I have not been able to work out how I can access other attributes on the buttons. For example: how can I determine the CheckState of the button if I have CheckOnClick enabled?

Thanks for any help.
Sep 15, 2006 at 2:38 AM
originally posted by: PJackson

We solved this by creating a custom Command class (CheckSynchronizedCommand), Attribute and a WorkItemExtension. When a Command is executed we check it's type in the WorkItemExtension and if it's a CheckSynchronizedCommand we reverse the Checked property of all the invokers:

  • Handles Checking of the UIElement that executed the Command
  • Keeps other invokers in synch (i.e. toolbarbuttons and menus)
  • Keeps Checked in synch if the Command is executed from code
Sep 15, 2006 at 10:18 AM
originally posted by: MichaelDaniel

Thanks: sounds like a lot of work... any chance of some sample code?