共用方式為


RibbonReadOnlyCollection Interface

Provides access to the IRibbonExtension objects in a Ribbon customization.

Namespace:  Microsoft.Office.Tools.Ribbon
Assemblies:   Microsoft.Office.Tools.Common.v4.0.Utilities (in Microsoft.Office.Tools.Common.v4.0.Utilities.dll)
  Microsoft.Office.Tools.Common (in Microsoft.Office.Tools.Common.dll)

Syntax

'Declaration
<GuidAttribute("c3b587bc-42bc-401b-a1e7-f85777d5156a")> _
Public Interface RibbonReadOnlyCollection _
    Inherits IList(Of IRibbonExtension), ICollection(Of IRibbonExtension),  _
    IEnumerable(Of IRibbonExtension), IEnumerable
[GuidAttribute("c3b587bc-42bc-401b-a1e7-f85777d5156a")]
public interface RibbonReadOnlyCollection : IList<IRibbonExtension>, 
    ICollection<IRibbonExtension>, IEnumerable<IRibbonExtension>, IEnumerable

The RibbonReadOnlyCollection type exposes the following members.

Properties

  Name Description
Public property Count Gets the number of elements contained in the ICollection<T>. (Inherited from ICollection<IRibbonExtension>.)
Public property IsReadOnly Gets a value indicating whether the ICollection<T> is read-only. (Inherited from ICollection<IRibbonExtension>.)
Public property Item Gets or sets the element at the specified index. (Inherited from IList<IRibbonExtension>.)

Top

Methods

  Name Description
Public method Add Adds an item to the ICollection<T>. (Inherited from ICollection<IRibbonExtension>.)
Public method Clear Removes all items from the ICollection<T>. (Inherited from ICollection<IRibbonExtension>.)
Public method Contains Determines whether the ICollection<T> contains a specific value. (Inherited from ICollection<IRibbonExtension>.)
Public method CopyTo Copies the elements of the ICollection<T> to an Array, starting at a particular Array index. (Inherited from ICollection<IRibbonExtension>.)
Public method GetEnumerator Returns an enumerator that iterates through the collection. (Inherited from IEnumerable<IRibbonExtension>.)
Public method GetRibbon Infrastructure. Returns an instance of an IRibbonExtension of the specified type, if it exists in this RibbonReadOnlyCollection.
Public method GetRibbonContextCollection Infrastructure. Returns a collection of IRibbonExtension objects that are associated with a specified message class or application.
Public method IndexOf Determines the index of a specific item in the IList<T>. (Inherited from IList<IRibbonExtension>.)
Public method Insert Inserts an item to the IList<T> at the specified index. (Inherited from IList<IRibbonExtension>.)
Public method Remove Removes the first occurrence of a specific object from the ICollection<T>. (Inherited from ICollection<IRibbonExtension>.)
Public method RemoveAt Removes the IList<T> item at the specified index. (Inherited from IList<IRibbonExtension>.)

Top

Remarks

The collection represented by this object can contain either all IRibbonExtension objects of any type in a Ribbon customization, or only those IRibbonExtension objects for a particular message class or Microsoft Office application.

When you add a Ribbon to a project, Visual Studio adds the Globals class to your application. The Ribbons property of the Globals class returns an instance that is derived from the RibbonCollectionBase class. You can use the Globals.Ribbons collection to access Ribbons that are associated with your Office customization.

Note

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.

Usage

This documentation describes the version of this type that is used in Office projects that target the .NET Framework 4 and the .NET Framework 4.5. 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: https://go.microsoft.com/fwlink/?LinkId=160658.

See Also

Reference

Microsoft.Office.Tools.Ribbon Namespace

Other Resources

Accessing the Ribbon at Run Time

Global Access to Objects in Office Projects