RibbonMenu Interface

 

Represents a menu on a Ribbon tab or on the Microsoft Office Menu.

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

[GuidAttribute("59dc7f42-aca2-484a-9622-1ee34a6cfd7d")]
public interface class RibbonMenu : RibbonControl, RibbonComponent, 
	IComponent, IDisposable

NameDescription
System_CAPS_pubpropertyControlSize

Gets or sets the size of the menu.

System_CAPS_pubpropertyDescription

Gets or sets the text that appears on the current menu.

System_CAPS_pubpropertyDynamic

Gets or sets a value that indicates whether the menu can be modified at run time.

System_CAPS_pubpropertyEnabled

Gets or sets a value that indicates whether this RibbonControl is enabled.(Inherited from RibbonControl.)

System_CAPS_pubpropertyId

Gets a string that Microsoft Office uses to identify this RibbonControl object.(Inherited from RibbonControl.)

System_CAPS_pubpropertyImage

Gets or sets the image that is displayed on the menu.

System_CAPS_pubpropertyImageName

Gets or sets the name that you can use in the LoadImage event handler to identify an image for the menu.

System_CAPS_pubpropertyItems

Gets the collection of controls that are on the menu.

System_CAPS_pubpropertyItemSize

Gets or sets the size of the controls on the menu.

System_CAPS_pubpropertyKeyTip

Gets or sets the keyboard access key of the menu.

System_CAPS_pubpropertyLabel

Gets or sets the text that is displayed by the menu.

System_CAPS_pubpropertyName

Gets or sets the name of this RibbonComponent.(Inherited from RibbonComponent.)

System_CAPS_pubpropertyOfficeImageId

Gets or sets the image to display on the menu, if you want to use a built-in Microsoft Office icon.

System_CAPS_pubpropertyParent

Gets a RibbonComponent that represents the parent of this RibbonComponent.(Inherited from RibbonComponent.)

System_CAPS_pubpropertyPosition

Gets or sets the position of the menu, if the menu is on the Microsoft Office Menu.

System_CAPS_pubpropertyRibbon

Gets the top-level Ribbon object that contains the control hierarchy.(Inherited from RibbonComponent.)

System_CAPS_pubpropertyRibbonUI

This API supports the product infrastructure and is not intended to be used directly from your code. Gets the IRibbonUI instance that is provided by the Microsoft Office application to the Ribbon extensibility code.(Inherited from RibbonComponent.)

System_CAPS_pubpropertyScreenTip

Gets or sets tip text that appears when the user moves the pointer over the menu.

System_CAPS_pubpropertyShowImage

Gets or sets a value that indicates whether the image that is associated with the menu is visible.

System_CAPS_pubpropertyShowLabel

Gets or sets a value that indicates whether the label for the menu is visible.

System_CAPS_pubpropertySite

(Inherited from IComponent.)

System_CAPS_pubpropertySuperTip

Gets or sets multiline tip text that appears when the user moves the pointer over the menu.

System_CAPS_pubpropertyTag

Gets or sets application-specific data that is associated with this RibbonComponent.(Inherited from RibbonComponent.)

System_CAPS_pubpropertyTitle

Gets or sets the title that is displayed when the user expands a menu that is added to the Microsoft Office Menu.

System_CAPS_pubpropertyVisible

Gets or sets a value that indicates whether this RibbonControl is visible.(Inherited from RibbonControl.)

NameDescription
System_CAPS_pubmethodDispose()

(Inherited from IDisposable.)

System_CAPS_pubmethodPerformDynamicLayout()

Calls the Microsoft.Office.Core.IRibbonUI.InvalidateControl method of the parent control if the RibbonComponent has a dynamic parent, such as a dynamic menu, and layout is not suspended.(Inherited from RibbonComponent.)

System_CAPS_pubmethodPerformLayout()

Calls Microsoft.Office.Core.IRibbonUI.InvalidateControl if the RibbonComponent has a parent and layout is not suspended.(Inherited from RibbonComponent.)

System_CAPS_pubmethodResumeLayout()

Reverses the effect of the SuspendLayout method.(Inherited from RibbonComponent.)

System_CAPS_pubmethodResumeLayout(Boolean)

Reverses the effect of the SuspendLayout method.(Inherited from RibbonComponent.)

System_CAPS_pubmethodSuspendLayout()

Prevents the Microsoft Office application from refreshing the state of controls on the Ribbon.(Inherited from RibbonComponent.)

NameDescription
System_CAPS_pubeventDisposed

(Inherited from IComponent.)

System_CAPS_pubeventItemsLoading

Occurs when controls or nested menus are loaded into the current menu at run time.

Visual Studio creates a RibbonMenu object when you drag a Menu control from the Office Ribbon Controls tab of the Toolbox onto the Ribbon Designer.

You can create a RibbonMenu at run time by using the CreateRibbonMenu method of the RibbonFactory object.

There are two ways to access the RibbonFactory object:

  • By using the Factory property of the Ribbon class. Use this approach from code in your Ribbon class.

  • By using the Globals.Factory.GetRibbonFactory method. Use this approach from code outside your Ribbon class.

The following table lists members that are useful for common tasks. All of these tasks can be performed at design time. Some of these tasks can be performed at run time only before the Ribbon is loaded into the Office application or before the control is added to a dynamic menu at run time. For more information, see Ribbon Object Model Overview.

Task

Member

Display an image on the menu.

Use the Image or ImageName property.

You can also reuse images that appear in built-in Ribbon controls. To do this, set OfficeImageId to the ID of a built-in Microsoft Office image that you want to display as the icon for the menu.

Change the size of the menu.

Set the ControlSize property to the value you want. For example, for a large menu, set it to Microsoft.Office.Core.RibbonControlSize.RibbonControlSizeLarge.

Change the size of items in the menu.

Set the ItemSize property to the value you want. For example, to display larger items, set it to Microsoft.Office.Core.RibbonControlSize.RibbonControlSizeLarge.

Enable changes to the menu at run time (for example, to enable controls to be added to the menu at run time).

Set the Dynamic property to true.

Access the controls in the menu, add controls to the menu, or remove controls from the menu.

Use the Items property.

Add a menu to the Microsoft Office Menu, a group, or to another control that can contain menus.

Add a RibbonMenu to the Items property of the Microsoft Office Menu, group, or control.

System_CAPS_noteNote

This interface is implemented by the Visual Studio Tools for Office runtime. It is not intended to be implemented in your code. For more information, see Visual Studio Tools for Office Runtime Overview.

This documentation describes the version of this type that is used in Office projects that target the .NET Framework 4 or later. In projects that target the .NET Framework 3.5, this type might have different members and the code examples provided for this type might not work. For documentation about this type in projects that target the .NET Framework 3.5, see the following reference section in the Visual Studio 2008 documentation: http://go.microsoft.com/fwlink/?LinkId=160658.

The following example demonstrates how to add and populate a sub-menu to an existing menu at run time.

For a richer example that updates controls at run-time and involves getting data from the AdventureWorks sample database using Language-Integrated Queries (LINQ), see Walkthrough: Updating the Controls on a Ribbon at Run Time.

To run this code example, you must first perform the following steps:

  1. Add a Ribbon (Visual Designer) item to an Office project.

  2. Add a group to the custom tab.

  3. Add a menu to the group.

  4. Set the (Name) property of the menu to CustomerMenu.

  5. Set the Label property of the menu to Customers.

  6. Set the Dynamic property of the menu to true.

    This enables you to add and remove controls on the menu at run time after the Ribbon is loaded into the Office application.

No code example is currently available or this language may not be supported.
Return to top
Show: