Button element

Represents a Button control.

Usage

<Button
  ApplicationModes = "xs:string"
  CommandName = "xs:positiveInteger or xs:string"
  ApplicationDefaults.IsChecked = "Boolean"/>

Attributes

Attribute Type Required Description
ApplicationDefaults.IsChecked
Boolean
No
This attribute is valid only when the Button element is a child of QuickAccessToolbar.ApplicationDefaults.
Restricted to one of the following values:

(true)
Default.
(false)
ApplicationModes
xs:string
No
Valid only if MenuGroup is the parent element.

(xs:string)
A string that contains a comma-separated list of integers between 0 and 31.
White space is valid and ignored.
Maximum length: 250 characters.
CommandName
xs:positiveInteger or xs:string
No
Associates the element with a Command.

(xs:positiveInteger or xs:string)
A string, an integer value between 2 and 59999, inclusive, or a hexadecimal value between 0x2 and 0xea5f, inclusive.
The value must be unique within the Ribbon XML document.
Maximum length: 100 characters.

Child elements

There are no child elements.

Parent elements

Element
ControlGroup
DropDownButton
DropDownGallery
Group
MenuGroup
QuickAccessToolbar.ApplicationDefaults
SplitButton
SplitButton.ButtonItem
SplitButtonGallery

Remarks

Optional.

May occur at most once for each SplitButton.ButtonItem element.

May occur one or more times for each ControlGroup, DropDownButton, DropDownGallery, Group, MenuGroup, QuickAccessToolbar.ApplicationDefaults, SplitButton, or SplitButtonGallery element.

Button supports application modes when it is hosted in the left column of the Application Menu.

Examples

The following example demonstrates the basic markup for the Button.

This section of code shows the Button Command declarations, with an associated Group that acts as the parent container for the Button element.

<!-- Button -->
<Command Name="cmdButtonGroup"
         Symbol="cmdButtonGroup"
         Comment="Button Group"
         LabelTitle="ButtonGroup"/>
<Command Name="cmdButton1"
         Symbol="cmdButton1"
         Comment="Button1"
         LabelTitle="Button1"/>
<Command Name="cmdButton2"
         Symbol="cmdButton2"
         Comment="Button2"
         LabelTitle="Button2"/>
<Command Name="cmdButton3"
         Symbol="cmdButton3"
         Comment="Button3"
         LabelTitle="Button3"/>
<Command Name="cmdButtonGroup2"
         Symbol="cmdButtonGroup2"
         Comment="Button Group2"
         LabelTitle="ButtonGroup2"/>
<Command Name="cmdButtonG21"
         Symbol="cmdButtonG21"
         Comment="ButtonG21"
         LabelTitle="ButtonG21">
  <Command.LargeImages>
    <Image Source="res/large.bmp"/>
  </Command.LargeImages>
  <Command.SmallImages>
    <Image Source="res/small.bmp"/>
  </Command.SmallImages>
</Command>
<Command Name="cmdButtonG22"
         Symbol="cmdButtonG22"
         Comment="ButtonG22"
         LabelTitle="ButtonG22">
  <Command.LargeImages>
    <Image Source="res/large.bmp"/>
  </Command.LargeImages>
  <Command.SmallImages>
    <Image Source="res/small.bmp"/>
  </Command.SmallImages>
</Command>
<Command Name="cmdButtonG23"
         Symbol="cmdButtonG23"
         Comment="ButtonG23"
         LabelTitle="ButtonG23">
  <Command.LargeImages>
    <Image Source="res/large.bmp"/>
  </Command.LargeImages>
  <Command.SmallImages>
    <Image Source="res/small.bmp"/>
  </Command.SmallImages>
</Command>
<Command Name="cmdButtonG24"
         Symbol="cmdButtonG24"
         Comment="ButtonG24"
         LabelTitle="ButtonG24">
  <Command.LargeImages>
    <Image Source="res/large.bmp"/>
  </Command.LargeImages>
  <Command.SmallImages>
    <Image Source="res/small.bmp"/>
  </Command.SmallImages>
</Command>

This section of code shows the Button control declarations.

<Group CommandName="cmdButtonGroup"
       SizeDefinition="ThreeButtons">
  <Button CommandName="cmdButton1"></Button>
  <Button CommandName="cmdButton2"></Button>
  <Button CommandName="cmdButton3"></Button>
</Group>

Element information

  • Minimum supported system: Windows 7
  • Can be empty: Yes

See also

Button control

SetModes