Share via


RibbonGallery Class (2007 System)

Represents a control that displays a menu of RibbonDropDownItem objects and RibbonButton controls.

Namespace:  Microsoft.Office.Tools.Ribbon
Assembly:  Microsoft.Office.Tools.Common.v9.0 (in Microsoft.Office.Tools.Common.v9.0.dll)

Syntax

'Declaration
<ToolboxBitmapAttribute(GetType(RibbonGallery), "RibbonGallery.bmp")> _
Public NotInheritable Class RibbonGallery _
    Inherits RibbonControl
'Usage
Dim instance As RibbonGallery
[ToolboxBitmapAttribute(typeof(RibbonGallery), "RibbonGallery.bmp")]
public sealed class RibbonGallery : RibbonControl
[ToolboxBitmapAttribute(typeof(RibbonGallery), L"RibbonGallery.bmp")]
public ref class RibbonGallery sealed : public RibbonControl
public final class RibbonGallery extends RibbonControl

Remarks

Like the RibbonDropDown class, RibbonGallery displays a menu of RibbonDropDownItem objects and RibbonButton controls.

Unlike the RibbonDropDown class, the RibbonGallery class raises Click events, rather than SelectionChanged events, when a user clicks a RibbonDropDownItem. This means, for example, that the Click event is raised twice when a user clicks the same RibbonDropDownItem twice. (The SelectionChanged event would be raised at most once when the initial selection was made for the same scenario on a RibbonDropDown, depending on what the selection was before the first click.)

The ShowItemSelection property controls whether the currently selected RibbonDropDownItem is visually differentiated from the unselected items. Only one item at a time can be selected in a RibbonGallery.

The ItemImageSize property can be used to specify image sizes other than 16x16 and 32x32.

You can add RibbonDropDownItem objects to a RibbonGallery at design time or at run time.

To add RibbonDropDownItem objects at design time

  1. Click the Items property in the Properties window.

  2. Click the ellipsis (...).

  3. In the DropDown Collection Editor, add, order, and edit new items.

The following steps explain how to add a RibbonDropDownItem at run time.

To add a RibbonDropDownItem object at run time

  1. Create a new RibbonDropDownItem by using the RibbonDropDownItem.

  2. Add the RibbonDropDownItem you created to the Items collection of this RibbonGallery object.

You can add RibbonButton controls to a RibbonGallery at design time.

To add RibbonButton controls at design time

  1. Click the Buttons property in the Properties window.

  2. Click the ellipsis (...).

  3. In the Button Collection Editor, add, order, and edit new button controls.

Some properties of this control can be set only before the Ribbon is loaded into the Office application or before the control is added to a dynamic menu at run time. For information about setting these properties, see Ribbon Object Model Overview.

Inheritance Hierarchy

System.Object
  System.MarshalByRefObject
    System.ComponentModel.Component
      Microsoft.Office.Tools.Ribbon.RibbonComponent
        Microsoft.Office.Tools.Ribbon.RibbonControl
          Microsoft.Office.Tools.Ribbon.RibbonGallery

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

RibbonGallery Members

Microsoft.Office.Tools.Ribbon Namespace

Other Resources

Ribbon Overview

Ribbon Designer

Ribbon Object Model Overview

How to: Get Started Customizing the Ribbon