A button control associated with a command.

Parent Elements

This element can appear as a child of the following elements.

ElementDescriptionVersion IntroducedPro Version Introduced
<Backstage>The list of buttons and pages in the popup that appears when the user clicks the system button.1.03.2
<Group>A single group that appears within a single tab and contains controls.1.03.2
<QuickAccessControls>A list of controls that appear in the quick access toolbar.1.03.2
<SplitButton>A button control with a drop down that can contain other controls.1.03.2
<TabBarControls>The list of controls that appear on the right end of the tab bar area.1.03.2

Child Elements

The following elements can be children of this one.

ElementDescriptionAppearsVersion IntroducedPro Version Introduced
<Command>A single command that is associated to one or more buttons on the ribbon.Zero or once1.03.2

Attributes

This element supports the following attributes:

AttributeDescriptionVersion IntroducedPro Version Introduced
BeginGroupDetermines if this control begins a new group.1.03.2
CommandThe command associated with this button1.03.2
KeyThe unique identifier of the button. (Required)1.03.2
ForceSmallForces the button to use the small button layout.n/a4.0.1

BeginGroup

The BeginGroup attribute can be set to "True" or "False". When set to "True", it informs the ribbon that this control should not be grouped with the control before it and should be the first control in a new group. This attribute only works if the control is in a group whose GroupControls attribute is "True".

Command

The Command attribute lets you associate an existing command with this button. Associated a button to a command is the only way to set it's icon, caption, etc. If you omit this attribute, then you need to include a child <Command> element within the button element.

Key

The Key attribute defines a unique identifier for the button. The identifier must be unique among controls but can share the same identifier as other elements such as commands or tabs.

ForceSmall

The ForceSmall attribute can be used to ensure that a button will always use the small button layout even if there is room for a large button layout. Useful when you want to demphasize a button or have a little more control over layout. Set this to "true" to activate. (Only available in 4.0.1 or later.)

Remarks

The Button element defines a button control. In order to set the button's caption, icon, and other attributes, you must associate it with a command. You can do this using either the Command attribute as explained above or by including a child <Command> element.

Example

<Button Command="SAVE" />
<Button>
  <Command Key="SAVE_AS" Caption="Save As" KeyboardTip="A"
           LargeIcon="Images\32x32\save.png"
           SmallIcon="Images\16x16\save.png"
           Tooltip="Saves the document to the selected file." />
</Button>
  • No labels