The root element for XML passed to AddControls.

Child Elements

The following elements can be children of this one.

ElementDescriptionAppearsVersion IntroducedPro Version Introduced
<Group>The group to which the controls will be added.Zero or more1.03.2
<QuickAccessControls>The quick access toolbar.Zero or once1.03.2
<TabBarControls>The right end of the tab bar area.Zero or once1.03.2
<SplitButton>A button control with a drop down that can contain other controls.Zero or once1.03.2

Remarks

The AddControls element is the root element when calling the AddControls method. It does not matter where you got the XML snippet so long as there is a root element called AddControls.

Inside this element, you can only have <Group><QuickAccessControls><TabBarControls>, and <SplitButton> elements. The QuickAccessControls and TabBarControls elements are straight forward since they always refer to the same place on the ribbon.

Group elements, on the other hand, require some explanation. You cannot create new groups. If you want to add new groups, then you need to call the AddGroups method. Instead, any Group element in this tag must include a Key attribute that references an existing group. Everything inside the group tag is then handled normally, just as it would have been handled in the Init method.

The SplitButton element must reference an existing split button (using the Key attribute) only if it appears within this AddControls tag. If it appears within any other tag, then it is treated as a new control.

Example

In the following example, we are adding a Find button to four different places: a group whose key is "EDITING", the Quick Access toolbar, the Tab Bar area, and to a Split Button's sub-menu dropdown. Note how we define the button's command the first time, then simply reference the command in all the other buttons. Thus, no matter which button the user clicks, the same event fires. All four buttons need to have a unique Key, even though they can share the same command.

<AddControls>
  <Group Key="EDITING">
    <Button Key="BTN_FIND">
      <Command Key="FIND" Caption="Find" SmallIcon="Icons\find.png" />
    </Button>
  </Group>
  <QuickAccessControls>
    <Button Key="QA_BTN_FIND" Command="FIND" />
  </QuickAccessControls>
  <TabBarControls>
    <Button Key="TB_BTN_FIND" Command="FIND" />
  </TabBarControls>
  <SplitButton Key="MY_SPLIT_BUTTON">
    <Button Key="SPL_BTN_FIND" Command="FIND" />
  </SplitButton>
</AddControls>
  • No labels