SharePoint Ribbon. Creating multi level menu

Saturday, December 29, 2012

SharePoint 2010/2013 Ribbon API [In Russian]
SharePoint Ribbon. Using ColorPicker [In Russian]
SharePoint Ribbon. Creating multi level menu

Another use case of QASPRibbon: creating multi level menu in Ribbon.

In SharePoint dropdown menu is available in following elements: FlyoutAnchor, SplitButton, MRUSplitButon, DropDown and ComboBox. Each menu contains sections (MenuSection) which can contain buttons (Button) or flyout anchors (FlyoutAnchor) for showing sub level menu.

Declaration of drop down menu (DropDown) which contains menu and sub menu is like the following (without attributes):

  1. <DropDown>
  2.   <Menu>
  3.     <Controls>
  4.       <MenuSection>
  5.         <Controls>
  6.           <Button><!-- Button - menu item --></Button>
  7.           <FlyoutAnchor> <!-- Fly out anchor -->
  8.             <Menu>
  9.               <Controls>
  10.                 <MenuSection>
  11.                   <Controls>
  12.                     <Button><!-- Button - menu item --><Button>
  13.                   </Controls>
  14.                 </MenuSection>
  15.               </Controls>
  16.             </Menu>
  17.           </FlyoutAnchor>
  18.         </Controls>
  19.       </MenuSection>
  20.     </Controls>
  21.   </Menu>
  22. </DropDown>

The result is a two tired menu. First of them contains button and anchor to second tire containing a button.

To achieve the same result using QASPRibbon just use the followin code:

  1. var dropDown = new RibbonDropDown("DropDownId""DropDownTitle")
  2. {
  3.     Sections = new[]
  4.     {
  5.         new RibbonMenuSection("SectionId""SectionTitle")
  6.         {
  7.             Controls = new RibbonControl[]
  8.             {
  9.                 new RibbonButton("ButtonId""ButtonTitle"),
  10.                 new RibbonFlyoutAnchor("FlyoutAnchorId""FlyoutAnchorTitle")
  11.                 {
  12.                     Sections = new[]
  13.                     {
  14.                         new RibbonMenuSection("SectionId""SectionTitle")
  15.                         {
  16.                             Controls = new RibbonControl[]
  17.                             {
  18.                                 new RibbonButton("ButtonId""ButtonTitle")
  19.                             }
  20.                         }
  21.                     }
  22.                 }
  23.             }
  24.         }
  25.     }
  26. };

At first sight this code is not good. But there are these undeniable advantages:

  • Creating menu dynamically based on any data (SharePoint list) is very simple. Using of .Select(x=> new RibbonButton(x.Id.ToString(), x.Title){...}) method is almost always enough. You can write 2-3 methods which generate XML-declaration, but the convenience of this approach will be poor. Encapsulation is very easy to develop and support solutions;
  • Using a handler on the server side. Again, encapsulation, to avoid problems;
  • Modification of ribbon-element. In case of using native SharePoint API you have to parse XML (testing of this solution will cost dearly). In case of using QASRibbon classes your solution becomes very simple;

Creating menu

For convenience, create a simple method that returns the menu section, the above:

  1. private RibbonMenuSection[] GetFakeMenuSections()
  2. {
  3.     return new[]
  4.     {
  5.         new RibbonMenuSection("SectionId""SectionTitle")
  6.         {
  7.             //Image 32x32 + text
  8.             DisplayMode = RibbonMenuDisplayMode.Menu32,
  9.             Controls = new RibbonControl[]
  10.             {
  11.                 new RibbonButton("ButtonId""ButtonTitle")
  12.                 {
  13.                     Image = RibbonImageDefinition.Standard(7, 7)
  14.                 },
  15.                 new RibbonFlyoutAnchor("FlyoutAnchorId""FlyoutAnchorTitle")
  16.                 {
  17.                     Image = RibbonImageDefinition.Standard(7, 7),
  18.                     Sections = new[]
  19.                     {
  20.                         new RibbonMenuSection("SectionId""SectionTitle")
  21.                         {
  22.                             Controls = new RibbonControl[]
  23.                             {
  24.                                 new RibbonButton("ButtonId""ButtonTitle")
  25.                                 {
  26.                                     Image = RibbonImageDefinition.Standard(7, 7)
  27.                                 }
  28.                             }
  29.                         }
  30.                     }
  31.                 }
  32.             }
  33.         }
  34.     };
  35. }

This will reduce the amount of code in the future.

We now proceed directly to the creation of the menu. That's code for a simple tab, affiliated group and child drop-down menu:

  1. // A new tab
  2. var menuTab = new RibbonTab("MenuTab""Menu demo tab")
  3. {
  4.     // Sequential number is not multiple of 100
  5.     Sequence = 550,
  6.     // Setting a sequential number of element
  7.     Groups = new[]
  8.     {
  9.         // A new group of elements
  10.         new RibbonGroup("MenuGroup""Menu demo group")
  11.         {
  12.             // Setting &vertical alignment to middle
  13.             Alignment = RibbonGroupAlignment.Middle,
  14.             // Show image and label
  15.             DisplayMode = RibbonDisplayMode.Image16AndCaption,
  16.             // Elements in two rows
  17.             Template = RibbonGroupTemplate.TwoRows,
  18.             Controls = new RibbonControl[]
  19.             {
  20.                 new RibbonDropDown("DropDownId""DropDownTitle")
  21.                 {
  22.                     Sections = GetFakeMenuSections()
  23.                 },
  24.                 new RibbonComboBox("ComboBoxId""ComboBoxTitle")
  25.                 {
  26.                     Sections = GetFakeMenuSections()
  27.                 },
  28.                 new RibbonFlyoutAnchor("FlyoutAnchorId""FlyoutAnchorTitle")
  29.                 {
  30.                     Image = RibbonImageDefinition.Standard(7, 8),
  31.                     Sections = GetFakeMenuSections()
  32.                 },
  33.                 new RibbonSplitButton("SplitButtonId""SplitButtonTitle")
  34.                 {
  35.                     Image = RibbonImageDefinition.Standard(7, 8),
  36.                     Sections = GetFakeMenuSections()
  37.                 }
  38.             }
  39.         }
  40.     }
  41. };

A very simple code. SplitButton, the above, has an image, 'cause of it is not only menu container, but also a button. You can use MRUSplitButton element like SlitButton, but it requires one row layout of parent group.

I used tow-rows layout for group (TwoRows). What other layouts are and how the look you can see in the project documentation. Sequential number of group is not multiple of 100, these numbers are used by standard SharePoint tabs.

And now adding tab to the ribbon:

  1. RibbonManager.Current.AddTabToPage(menuTab, Page);

And the result of it in browser:

SharePoint Ribbon DropDown SharePoint Ribbon ComboBox SharePoint Ribbon FlyoutAnchor SharePoint Ribbon SplitButton

When a menu item in the ComboBox or DropDown controls are selected their corresponding container filled with text from the selected item and users will be able to see what they chose:

SharePoint Ribbon ComboBox

When using the standard tools for SharePoint Ribbon, would have to use here such XML-code:

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <Tab Id="Ribbon.MenuTab" Title="Menu demo tab" CssClass="" Sequence="550">
  3.  <Scaling Id="Ribbon.MenuTab.Scaling">
  4.   <MaxSize Id="Ribbon.MenuTab.MenuGroup.MaxSize" GroupId="Ribbon.MenuTab.MenuGroup" Size="Ribbon.MenuTab.MenuGroupLayout" Sequence="10" />
  5.  </Scaling>
  6.  <Groups Id="Ribbon.MenuTab.Groups">
  7.   <Group Id="Ribbon.MenuTab.MenuGroup" Title="Menu demo group" Description="" Sequence="1" Template="Ribbon.MenuTab.MenuGroupTemplate">
  8.    <Controls Id="Ribbon.MenuTab.MenuGroup.Controls">
  9.     <DropDown Id="Ribbon.MenuTab.MenuGroup.Controls.DropDownId" Sequence="1" Width="100px" TemplateAlias="Ribbon.MenuTab.MenuGroupLayout1MediumRowI" CacheMenuVersions="true" PopulateDynamically="false" PopulateOnlyOnce="false" QueryCommand="Ribbon.MenuTab.MenuGroup.Controls.DropDownIdQueryCommand" Command="Ribbon.MenuTab.MenuGroup.Controls.DropDownIdCommand" CommandMenuOpen="Ribbon.MenuTab.MenuGroup.Controls.DropDownIdCommandMenuOpen" CommandMenuClose="Ribbon.MenuTab.MenuGroup.Controls.DropDownIdCommandMenuClose">
  10.      <Menu Id="Ribbon.MenuTab.MenuGroup.Controls.DropDownId.Menu">
  11.       <MenuSection Id="Ribbon.MenuTab.MenuGroup.Controls.DropDownId.Menu.SectionId" Sequence="1" Title="SectionTitle" DisplayMode="Menu16" Scrollable="true">
  12.        <Controls Id="Ribbon.MenuTab.MenuGroup.Controls.DropDownId.Menu.SectionId.Controls">
  13.         <Button Id="Ribbon.MenuTab.MenuGroup.Controls.DropDownId.Menu.SectionId.Controls.ButtonId" Sequence="1" Image16by16="/_layouts/1033/images/formatmap16x16.png" Image32by32="/_layouts/1033/images/formatmap32x32.png" Image16by16Left="-112" Image32by32Left="-224" Image16by16Top="-112" Image32by32Top="-224" LabelText="ButtonTitle" MenuItemId="Ribbon.MenuTab.MenuGroup.Controls.DropDownId.Menu.SectionId.Controls.ButtonId" CommandValueId="Ribbon.MenuTab.MenuGroup.Controls.DropDownId.Menu.SectionId.Controls.ButtonIdCommand" Command="Ribbon.MenuTab.MenuGroup.Controls.DropDownId.Menu.SectionId.Controls.ButtonIdCommand" />
  14.         <FlyoutAnchor Id="Ribbon.MenuTab.MenuGroup.Controls.DropDownId.Menu.SectionId.Controls.FlyoutAnchorId" Sequence="2" Image16by16="/_layouts/1033/images/formatmap16x16.png" Image32by32="/_layouts/1033/images/formatmap32x32.png" Image16by16Left="-112" Image32by32Left="-224" Image16by16Top="-112" Image32by32Top="-224" LabelText="FlyoutAnchorTitle" TemplateAlias="" PopulateQueryCommand="Ribbon.MenuTab.MenuGroup.Controls.DropDownId.Menu.SectionId.Controls.FlyoutAnchorIdPopulateQueryCommand" CommandMenuClose="Ribbon.MenuTab.MenuGroup.Controls.DropDownId.Menu.SectionId.Controls.FlyoutAnchorIdCommandMenuClose" Command="Ribbon.MenuTab.MenuGroup.Controls.DropDownId.Menu.SectionId.Controls.FlyoutAnchorIdCommand" CommandQuery="Ribbon.MenuTab.MenuGroup.Controls.DropDownId.Menu.SectionId.Controls.FlyoutAnchorIdCommandQuery" CacheMenuVersions="true" PopulateDynamically="false" PopulateOnlyOnce="false">
  15.          <Menu Id="Ribbon.MenuTab.MenuGroup.Controls.DropDownId.Menu.SectionId.Controls.FlyoutAnchorId.Menu">
  16.           <MenuSection Id="Ribbon.MenuTab.MenuGroup.Controls.DropDownId.Menu.SectionId.Controls.FlyoutAnchorId.Menu.SectionId" Sequence="1" Title="SectionTitle" DisplayMode="Menu32" Scrollable="true">
  17.            <Controls Id="Ribbon.MenuTab.MenuGroup.Controls.DropDownId.Menu.SectionId.Controls.FlyoutAnchorId.Menu.SectionId.Controls">
  18.             <Button Id="Ribbon.MenuTab.MenuGroup.Controls.DropDownId.Menu.SectionId.Controls.FlyoutAnchorId.Menu.SectionId.Controls.ButtonId" Sequence="1" Image16by16="/_layouts/1033/images/formatmap16x16.png" Image32by32="/_layouts/1033/images/formatmap32x32.png" Image16by16Left="-112" Image32by32Left="-224" Image16by16Top="-112" Image32by32Top="-224" LabelText="ButtonTitle" MenuItemId="Ribbon.MenuTab.MenuGroup.Controls.DropDownId.Menu.SectionId.Controls.FlyoutAnchorId.Menu.SectionId.Controls.ButtonId" CommandValueId="Ribbon.MenuTab.MenuGroup.Controls.DropDownId.Menu.SectionId.Controls.FlyoutAnchorId.Menu.SectionId.Controls.ButtonIdCommand" Command="Ribbon.MenuTab.MenuGroup.Controls.DropDownId.Menu.SectionId.Controls.FlyoutAnchorId.Menu.SectionId.Controls.ButtonIdCommand" />
  19.            </Controls>
  20.           </MenuSection>
  21.          </Menu>
  22.         </FlyoutAnchor>
  23.        </Controls>
  24.       </MenuSection>
  25.      </Menu>
  26.     </DropDown>
  27.     <ComboBox Id="Ribbon.MenuTab.MenuGroup.Controls.ComboBoxId" Sequence="2" Width="100px" AutoComplete="true" AutoCompleteDelay="100" AllowFreeForm="false" TemplateAlias="Ribbon.MenuTab.MenuGroupLayout1MediumRowII" CacheMenuVersions="false" PopulateDynamically="false" PopulateOnlyOnce="false" QueryCommand="Ribbon.MenuTab.MenuGroup.Controls.ComboBoxIdQueryCommand" Command="Ribbon.MenuTab.MenuGroup.Controls.ComboBoxIdCommand" CommandMenuOpen="Ribbon.MenuTab.MenuGroup.Controls.ComboBoxIdCommandMenuOpen" CommandMenuClose="Ribbon.MenuTab.MenuGroup.Controls.ComboBoxIdCommandMenuClose" InitialItem="Ribbon.MenuTab.MenuGroup.Controls.ComboBoxId.Menu.SectionId.Controls.ButtonId">
  28.      <Menu Id="Ribbon.MenuTab.MenuGroup.Controls.ComboBoxId.Menu">
  29.       <MenuSection Id="Ribbon.MenuTab.MenuGroup.Controls.ComboBoxId.Menu.SectionId" Sequence="1" Title="SectionTitle" DisplayMode="Menu16" Scrollable="true">
  30.        <Controls Id="Ribbon.MenuTab.MenuGroup.Controls.ComboBoxId.Menu.SectionId.Controls">
  31.         <Button Id="Ribbon.MenuTab.MenuGroup.Controls.ComboBoxId.Menu.SectionId.Controls.ButtonId" Sequence="1" Image16by16="/_layouts/1033/images/formatmap16x16.png" Image32by32="/_layouts/1033/images/formatmap32x32.png" Image16by16Left="-112" Image32by32Left="-224" Image16by16Top="-112" Image32by32Top="-224" LabelText="ButtonTitle" MenuItemId="Ribbon.MenuTab.MenuGroup.Controls.ComboBoxId.Menu.SectionId.Controls.ButtonId" CommandValueId="Ribbon.MenuTab.MenuGroup.Controls.ComboBoxId.Menu.SectionId.Controls.ButtonIdCommand" Command="Ribbon.MenuTab.MenuGroup.Controls.ComboBoxId.Menu.SectionId.Controls.ButtonIdCommand" />
  32.         <FlyoutAnchor Id="Ribbon.MenuTab.MenuGroup.Controls.ComboBoxId.Menu.SectionId.Controls.FlyoutAnchorId" Sequence="2" Image16by16="/_layouts/1033/images/formatmap16x16.png" Image32by32="/_layouts/1033/images/formatmap32x32.png" Image16by16Left="-112" Image32by32Left="-224" Image16by16Top="-112" Image32by32Top="-224" LabelText="FlyoutAnchorTitle" TemplateAlias="" PopulateQueryCommand="Ribbon.MenuTab.MenuGroup.Controls.ComboBoxId.Menu.SectionId.Controls.FlyoutAnchorIdPopulateQueryCommand" CommandMenuClose="Ribbon.MenuTab.MenuGroup.Controls.ComboBoxId.Menu.SectionId.Controls.FlyoutAnchorIdCommandMenuClose" Command="Ribbon.MenuTab.MenuGroup.Controls.ComboBoxId.Menu.SectionId.Controls.FlyoutAnchorIdCommand" CommandQuery="Ribbon.MenuTab.MenuGroup.Controls.ComboBoxId.Menu.SectionId.Controls.FlyoutAnchorIdCommandQuery" CacheMenuVersions="true" PopulateDynamically="false" PopulateOnlyOnce="false">
  33.          <Menu Id="Ribbon.MenuTab.MenuGroup.Controls.ComboBoxId.Menu.SectionId.Controls.FlyoutAnchorId.Menu">
  34.           <MenuSection Id="Ribbon.MenuTab.MenuGroup.Controls.ComboBoxId.Menu.SectionId.Controls.FlyoutAnchorId.Menu.SectionId" Sequence="1" Title="SectionTitle" DisplayMode="Menu32" Scrollable="true">
  35.            <Controls Id="Ribbon.MenuTab.MenuGroup.Controls.ComboBoxId.Menu.SectionId.Controls.FlyoutAnchorId.Menu.SectionId.Controls">
  36.             <Button Id="Ribbon.MenuTab.MenuGroup.Controls.ComboBoxId.Menu.SectionId.Controls.FlyoutAnchorId.Menu.SectionId.Controls.ButtonId" Sequence="1" Image16by16="/_layouts/1033/images/formatmap16x16.png" Image32by32="/_layouts/1033/images/formatmap32x32.png" Image16by16Left="-112" Image32by32Left="-224" Image16by16Top="-112" Image32by32Top="-224" LabelText="ButtonTitle" MenuItemId="Ribbon.MenuTab.MenuGroup.Controls.ComboBoxId.Menu.SectionId.Controls.FlyoutAnchorId.Menu.SectionId.Controls.ButtonId" CommandValueId="Ribbon.MenuTab.MenuGroup.Controls.ComboBoxId.Menu.SectionId.Controls.FlyoutAnchorId.Menu.SectionId.Controls.ButtonIdCommand" Command="Ribbon.MenuTab.MenuGroup.Controls.ComboBoxId.Menu.SectionId.Controls.FlyoutAnchorId.Menu.SectionId.Controls.ButtonIdCommand" />
  37.            </Controls>
  38.           </MenuSection>
  39.          </Menu>
  40.         </FlyoutAnchor>
  41.        </Controls>
  42.       </MenuSection>
  43.      </Menu>
  44.     </ComboBox>
  45.     <FlyoutAnchor Id="Ribbon.MenuTab.MenuGroup.Controls.FlyoutAnchorId" Sequence="3" Image16by16="/_layouts/1033/images/formatmap16x16.png" Image32by32="/_layouts/1033/images/formatmap32x32.png" Image16by16Left="-112" Image32by32Left="-224" Image16by16Top="-128" Image32by32Top="-256" LabelText="FlyoutAnchorTitle" TemplateAlias="Ribbon.MenuTab.MenuGroupLayout2MediumRowI" PopulateQueryCommand="Ribbon.MenuTab.MenuGroup.Controls.FlyoutAnchorIdPopulateQueryCommand" CommandMenuClose="Ribbon.MenuTab.MenuGroup.Controls.FlyoutAnchorIdCommandMenuClose" Command="Ribbon.MenuTab.MenuGroup.Controls.FlyoutAnchorIdCommand" CommandQuery="Ribbon.MenuTab.MenuGroup.Controls.FlyoutAnchorIdCommandQuery" CacheMenuVersions="true" PopulateDynamically="false" PopulateOnlyOnce="false">
  46.      <Menu Id="Ribbon.MenuTab.MenuGroup.Controls.FlyoutAnchorId.Menu">
  47.       <MenuSection Id="Ribbon.MenuTab.MenuGroup.Controls.FlyoutAnchorId.Menu.SectionId" Sequence="1" Title="SectionTitle" DisplayMode="Menu16" Scrollable="true">
  48.        <Controls Id="Ribbon.MenuTab.MenuGroup.Controls.FlyoutAnchorId.Menu.SectionId.Controls">
  49.         <Button Id="Ribbon.MenuTab.MenuGroup.Controls.FlyoutAnchorId.Menu.SectionId.Controls.ButtonId" Sequence="1" Image16by16="/_layouts/1033/images/formatmap16x16.png" Image32by32="/_layouts/1033/images/formatmap32x32.png" Image16by16Left="-112" Image32by32Left="-224" Image16by16Top="-112" Image32by32Top="-224" LabelText="ButtonTitle" MenuItemId="Ribbon.MenuTab.MenuGroup.Controls.FlyoutAnchorId.Menu.SectionId.Controls.ButtonId" CommandValueId="Ribbon.MenuTab.MenuGroup.Controls.FlyoutAnchorId.Menu.SectionId.Controls.ButtonIdCommand" Command="Ribbon.MenuTab.MenuGroup.Controls.FlyoutAnchorId.Menu.SectionId.Controls.ButtonIdCommand" />
  50.         <FlyoutAnchor Id="Ribbon.MenuTab.MenuGroup.Controls.FlyoutAnchorId.Menu.SectionId.Controls.FlyoutAnchorId" Sequence="2" Image16by16="/_layouts/1033/images/formatmap16x16.png" Image32by32="/_layouts/1033/images/formatmap32x32.png" Image16by16Left="-112" Image32by32Left="-224" Image16by16Top="-112" Image32by32Top="-224" LabelText="FlyoutAnchorTitle" TemplateAlias="" PopulateQueryCommand="Ribbon.MenuTab.MenuGroup.Controls.FlyoutAnchorId.Menu.SectionId.Controls.FlyoutAnchorIdPopulateQueryCommand" CommandMenuClose="Ribbon.MenuTab.MenuGroup.Controls.FlyoutAnchorId.Menu.SectionId.Controls.FlyoutAnchorIdCommandMenuClose" Command="Ribbon.MenuTab.MenuGroup.Controls.FlyoutAnchorId.Menu.SectionId.Controls.FlyoutAnchorIdCommand" CommandQuery="Ribbon.MenuTab.MenuGroup.Controls.FlyoutAnchorId.Menu.SectionId.Controls.FlyoutAnchorIdCommandQuery" CacheMenuVersions="true" PopulateDynamically="false" PopulateOnlyOnce="false">
  51.          <Menu Id="Ribbon.MenuTab.MenuGroup.Controls.FlyoutAnchorId.Menu.SectionId.Controls.FlyoutAnchorId.Menu">
  52.           <MenuSection Id="Ribbon.MenuTab.MenuGroup.Controls.FlyoutAnchorId.Menu.SectionId.Controls.FlyoutAnchorId.Menu.SectionId" Sequence="1" Title="SectionTitle" DisplayMode="Menu32" Scrollable="true">
  53.            <Controls Id="Ribbon.MenuTab.MenuGroup.Controls.FlyoutAnchorId.Menu.SectionId.Controls.FlyoutAnchorId.Menu.SectionId.Controls">
  54.             <Button Id="Ribbon.MenuTab.MenuGroup.Controls.FlyoutAnchorId.Menu.SectionId.Controls.FlyoutAnchorId.Menu.SectionId.Controls.ButtonId" Sequence="1" Image16by16="/_layouts/1033/images/formatmap16x16.png" Image32by32="/_layouts/1033/images/formatmap32x32.png" Image16by16Left="-112" Image32by32Left="-224" Image16by16Top="-112" Image32by32Top="-224" LabelText="ButtonTitle" MenuItemId="Ribbon.MenuTab.MenuGroup.Controls.FlyoutAnchorId.Menu.SectionId.Controls.FlyoutAnchorId.Menu.SectionId.Controls.ButtonId" CommandValueId="Ribbon.MenuTab.MenuGroup.Controls.FlyoutAnchorId.Menu.SectionId.Controls.FlyoutAnchorId.Menu.SectionId.Controls.ButtonIdCommand" Command="Ribbon.MenuTab.MenuGroup.Controls.FlyoutAnchorId.Menu.SectionId.Controls.FlyoutAnchorId.Menu.SectionId.Controls.ButtonIdCommand" />
  55.            </Controls>
  56.           </MenuSection>
  57.          </Menu>
  58.         </FlyoutAnchor>
  59.        </Controls>
  60.       </MenuSection>
  61.      </Menu>
  62.     </FlyoutAnchor>
  63.     <SplitButton Id="Ribbon.MenuTab.MenuGroup.Controls.SplitButtonId" Sequence="4" Image16by16="/_layouts/1033/images/formatmap16x16.png" Image32by32="/_layouts/1033/images/formatmap32x32.png" Image16by16Left="-112" Image32by32Left="-224" Image16by16Top="-128" Image32by32Top="-256" LabelText="SplitButtonTitle" TemplateAlias="Ribbon.MenuTab.MenuGroupLayout2MediumRowII" MenuItemId="Ribbon.MenuTab.MenuGroup.Controls.SplitButtonId" CommandValueId="Ribbon.MenuTab.MenuGroup.Controls.SplitButtonIdCommand" Command="Ribbon.MenuTab.MenuGroup.Controls.SplitButtonIdCommand" CommandQuery="Ribbon.MenuTab.MenuGroup.Controls.SplitButtonIdCommandQuery">
  64.      <Menu Id="Ribbon.MenuTab.MenuGroup.Controls.SplitButtonId.Menu">
  65.       <MenuSection Id="Ribbon.MenuTab.MenuGroup.Controls.SplitButtonId.Menu.SectionId" Sequence="1" Title="SectionTitle" DisplayMode="Menu16" Scrollable="true">
  66.        <Controls Id="Ribbon.MenuTab.MenuGroup.Controls.SplitButtonId.Menu.SectionId.Controls">
  67.         <Button Id="Ribbon.MenuTab.MenuGroup.Controls.SplitButtonId.Menu.SectionId.Controls.ButtonId" Sequence="1" Image16by16="/_layouts/1033/images/formatmap16x16.png" Image32by32="/_layouts/1033/images/formatmap32x32.png" Image16by16Left="-112" Image32by32Left="-224" Image16by16Top="-112" Image32by32Top="-224" LabelText="ButtonTitle" MenuItemId="Ribbon.MenuTab.MenuGroup.Controls.SplitButtonId.Menu.SectionId.Controls.ButtonId" CommandValueId="Ribbon.MenuTab.MenuGroup.Controls.SplitButtonId.Menu.SectionId.Controls.ButtonIdCommand" Command="Ribbon.MenuTab.MenuGroup.Controls.SplitButtonId.Menu.SectionId.Controls.ButtonIdCommand" />
  68.         <FlyoutAnchor Id="Ribbon.MenuTab.MenuGroup.Controls.SplitButtonId.Menu.SectionId.Controls.FlyoutAnchorId" Sequence="2" Image16by16="/_layouts/1033/images/formatmap16x16.png" Image32by32="/_layouts/1033/images/formatmap32x32.png" Image16by16Left="-112" Image32by32Left="-224" Image16by16Top="-112" Image32by32Top="-224" LabelText="FlyoutAnchorTitle" TemplateAlias="" PopulateQueryCommand="Ribbon.MenuTab.MenuGroup.Controls.SplitButtonId.Menu.SectionId.Controls.FlyoutAnchorIdPopulateQueryCommand" CommandMenuClose="Ribbon.MenuTab.MenuGroup.Controls.SplitButtonId.Menu.SectionId.Controls.FlyoutAnchorIdCommandMenuClose" Command="Ribbon.MenuTab.MenuGroup.Controls.SplitButtonId.Menu.SectionId.Controls.FlyoutAnchorIdCommand" CommandQuery="Ribbon.MenuTab.MenuGroup.Controls.SplitButtonId.Menu.SectionId.Controls.FlyoutAnchorIdCommandQuery" CacheMenuVersions="true" PopulateDynamically="false" PopulateOnlyOnce="false">
  69.          <Menu Id="Ribbon.MenuTab.MenuGroup.Controls.SplitButtonId.Menu.SectionId.Controls.FlyoutAnchorId.Menu">
  70.           <MenuSection Id="Ribbon.MenuTab.MenuGroup.Controls.SplitButtonId.Menu.SectionId.Controls.FlyoutAnchorId.Menu.SectionId" Sequence="1" Title="SectionTitle" DisplayMode="Menu32" Scrollable="true">
  71.            <Controls Id="Ribbon.MenuTab.MenuGroup.Controls.SplitButtonId.Menu.SectionId.Controls.FlyoutAnchorId.Menu.SectionId.Controls">
  72.             <Button Id="Ribbon.MenuTab.MenuGroup.Controls.SplitButtonId.Menu.SectionId.Controls.FlyoutAnchorId.Menu.SectionId.Controls.ButtonId" Sequence="1" Image16by16="/_layouts/1033/images/formatmap16x16.png" Image32by32="/_layouts/1033/images/formatmap32x32.png" Image16by16Left="-112" Image32by32Left="-224" Image16by16Top="-112" Image32by32Top="-224" LabelText="ButtonTitle" MenuItemId="Ribbon.MenuTab.MenuGroup.Controls.SplitButtonId.Menu.SectionId.Controls.FlyoutAnchorId.Menu.SectionId.Controls.ButtonId" CommandValueId="Ribbon.MenuTab.MenuGroup.Controls.SplitButtonId.Menu.SectionId.Controls.FlyoutAnchorId.Menu.SectionId.Controls.ButtonIdCommand" Command="Ribbon.MenuTab.MenuGroup.Controls.SplitButtonId.Menu.SectionId.Controls.FlyoutAnchorId.Menu.SectionId.Controls.ButtonIdCommand" />
  73.            </Controls>
  74.           </MenuSection>
  75.          </Menu>
  76.         </FlyoutAnchor>
  77.        </Controls>
  78.       </MenuSection>
  79.      </Menu>
  80.     </SplitButton>
  81.    </Controls>
  82.   </Group>
  83.  </Groups>
  84. </Tab>

Finally about ComboBox. It supports auto-completion, but it works only for the first menu tire. All other menu items (on second tire and below) in the results do not appear. This does not stop them manually choose.

Share

Comments