In This Article

Buttons

Regular buttons are represented using the BarButtonCommand and a BarButtonLink classes. The BarButtonCommand class is the base command for the BarButtonLink, which is the command link.

See the Commands and Command Links topic for more information on commands and command links and how they relate to each other.

Screenshot

Screenshot

Regular buttons appear like a button when on a toolbar and appear like a normal menu item when on a menu. They can be clicked and an action can be taken in response to the click.

Checkable Buttons

Buttons can optionally become checkable and can be used in check groups. These options are set up on the command. See the Checkable Buttons topic for detailed information on working with checkable buttons.

Text and Images

Each command has a text and image value. The text value comes from the Text property. The image first looks at the Image property. If not specified, it looks to the ImageIndex property.

Each command link instance can override all of these properties as well with command link-specific property values. The command link versions of the properties are examined first when resolving the text and image values.

Enabling / Disabling

Command links can be enabled or disabled based on a resolved value of enabled properties, one on the command and one on the command link that can override it. The command link's Enabled accepts a DefaultableBoolean, which can override the command's Enabled property.

Keyboard Shortcuts

Keyboard shortcuts can be set to the command by adding the appropriate BarKeyboardShortcut instances to the KeyboardShortcuts collection on the command.

See the Keyboard Shortcuts topic for more information on keyboard shortcuts.

Begin a Group

The BeginAGroup property on each command link indicates whether the command link begins a group. If it does, a separator will be drawn before it.

Display Styles

The DisplayStyle property on each command link accepts a BarCommandLinkDisplayStyle enumeration value that indicates how to render the command link in terms of image and text display.

Visibility

The Visible property on each command link controls whether the command link is visible or invisible within its parent bar control.

Tooltips

Tooltips will be displayed for the command if the ToolTipEnabled property is set to true. The tooltip will display the value of the Text property unless the ToolTipText property overrides it with a different value. The ToolTipText property can be left as null to indicate to use the Text property instead.

Changing the Text Displayed in the Run-Time Customize Dialog for the Command

By default, the Text property value of the command will be displayed in the run-time customize dialog's command listbox. However if this is not appropriate or needs to be customized for the command listbox, the CustomizeListText property can be set to override what is displayed.