Represents a panel added by an External Application or External Command into the Add-Ins tab.
Inheritance Hierarchy
System.ObjectAutodesk.Revit.UI.RibbonPanel
Namespace: Autodesk.Revit.UI
Assembly: RevitAPIUI (in RevitAPIUI.dll) Version: 26.1.0.0 (26.1.0.34)
Syntax
C#
public class RibbonPanel
The RibbonPanel type exposes the following members.
Properties
Name | Description | |
---|---|---|
![]() | Enabled | Gets or sets a value indicating whether the RibbonPanel can respond to user interaction. |
![]() | Name | Gets or sets the name of the RibbonPanel. |
![]() | Title | Gets or sets the text of the RibbonPanel. |
![]() | Visible | Gets or sets a value indicating whether the RibbonPanel is displayed. |
Methods
Name | Description | |
---|---|---|
![]() | AddItem | Adds a Ribbon item to the panel. |
![]() | AddSeparator | Adds a new Separator to the panel. |
![]() ![]() | AddSlideOut | Adds a slideout to the current panel. |
![]() | AddStackedItems(RibbonItemData, RibbonItemData) | Adds two stacked items to the panel. |
![]() | AddStackedItems(RibbonItemData, RibbonItemData, RibbonItemData) | Adds three stacked items to the panel. |
![]() | Equals | Determines whether the specified Object is equal to the current Object. (Overrides Object.Equals(Object)) |
![]() | GetHashCode | Serves as the default hash function. (Inherited from Object) |
![]() | GetItems | Gets a copy of the collection of RibbonItems assigned to the RibbonPanel. |
![]() | GetType | Gets the Type of the current instance. (Inherited from Object) |
![]() | ToString | Returns a string that represents the current object. (Inherited from Object) |
Remarks
The Panel class provides read and write access to the RibbonItems contained in the panel. Use of this class is not supported in Revit Macros.Example
C#
public Result OnStartup(UIControlledApplication application) { // add new ribbon panel RibbonPanel ribbonPanel = application.CreateRibbonPanel("NewRibbonPanel"); //Create a push button in the ribbon panel �NewRibbonPanel" string assembly = @"D:\Sample\HelloWorld\bin\Debug\HelloWorld.dll"; PushButton pushButton = ribbonPanel.AddItem(new PushButtonData("Hello Button", "Hello Button", assembly, "Hello.HelloButton")) as PushButton; // create bitmap image for button Uri uriImage = new Uri(@"D:\Sample\HelloWorld\bin\Debug\39-Globe_32x32.png"); BitmapImage largeImage = new BitmapImage(uriImage); // assign bitmap to button pushButton.LargeImage = largeImage; // assign a small bitmap to button which is used if command // is moved to Quick Access Toolbar Uri uriSmallImage = new Uri(@"D:\Sample\HelloWorld\bin\Debug\39-Globe_16x16.png"); BitmapImage smallImage = new BitmapImage(uriSmallImage); // assign small image to button pushButton.Image = smallImage; // add a vertical separator bar to the panel ribbonPanel.AddSeparator(); // define 3 new buttons to be added as stacked buttons PushButtonData buttonRed = new PushButtonData ("Hello Red", "Hello Red", assembly, "Hello.HelloRed"); buttonRed.Image = new BitmapImage(new Uri(@"D:\Sample\HelloWorld\bin\Debug\Red.bmp")); PushButtonData buttonBlue = new PushButtonData("Hello Blue", "Hello Blue", assembly, "Hello.HelloBlue"); buttonBlue.Image = new BitmapImage(new Uri(@"D:\Sample\HelloWorld\bin\Debug\Blue.bmp")); PushButtonData buttonGreen = new PushButtonData("Hello Green", "Hello Green", assembly, "Hello.HelloGreen"); buttonGreen.Image = new BitmapImage(new Uri(@"D:\Sample\HelloWorld\bin\Debug\Green.bmp")); // add 3 stacked buttons to the panel ribbonPanel.AddStackedItems(buttonRed, buttonBlue, buttonGreen); // add a pull-down button to the panel PulldownButton pulldownButton = ribbonPanel.AddItem(new PulldownButtonData("Hello", "Hello 123")) as PulldownButton; pulldownButton.LargeImage = new BitmapImage(new Uri(@"D:\Sample\HelloWorld\bin\Debug\Hello.bmp")); // add some menu items to the pull-down button and assign bitmaps to them PushButton buttonOne = pulldownButton.AddPushButton(new PushButtonData("Hello One", "Hello 123", assembly, "Hello.HelloOne")); buttonOne.LargeImage = new BitmapImage(new Uri(@"D:\Sample\HelloWorld\bin\Debug\One.bmp")); PushButton buttonTwo = pulldownButton.AddPushButton(new PushButtonData("Hello Two", "Hello 123", assembly, "Hello.HelloTwo")); buttonTwo.LargeImage = new BitmapImage(new Uri(@"D:\Sample\HelloWorld\bin\Debug\Two.bmp")); PushButton buttonThree = pulldownButton.AddPushButton(new PushButtonData("Hello Three", "Hello 123", assembly, "Hello.HelloThree")); buttonThree.LargeImage = new BitmapImage(new Uri(@"D:\Sample\HelloWorld\bin\Debug\Three.bmp")); return Result.Succeeded; }
VB
Public Function OnStartup(application As UIControlledApplication) As Autodesk.Revit.UI.Result Implements IExternalApplication.OnStartup ' add new ribbon panel Dim ribbonPanel As RibbonPanel = application.CreateRibbonPanel("NewRibbonPanel") 'Create a push button in the ribbon panel �NewRibbonPanel" Dim assembly As String = "D:\Sample\HelloWorld\bin\Debug\HelloWorld.dll" Dim pushButton As PushButton = TryCast(ribbonPanel.AddItem(New PushButtonData("Hello Button", "Hello Button", assembly, "Hello.HelloButton")), PushButton) ' create bitmap image for button Dim uriImage As New Uri("D:\Sample\HelloWorld\bin\Debug\39-Globe_32x32.png") Dim largeImage As New BitmapImage(uriImage) ' assign bitmap to button pushButton.LargeImage = largeImage ' assign a small bitmap to button which is used if command ' is moved to Quick Access Toolbar Dim uriSmallImage As New Uri("D:\Sample\HelloWorld\bin\Debug\39-Globe_16x16.png") Dim smallImage As New BitmapImage(uriSmallImage) ' assign small image to button pushButton.Image = smallImage ' add a vertical separator bar to the panel ribbonPanel.AddSeparator() ' define 3 new buttons to be added as stacked buttons Dim buttonRed As New PushButtonData("Hello Red", "Hello Red", assembly, "Hello.HelloRed") buttonRed.Image = New BitmapImage(New Uri("D:\Sample\HelloWorld\bin\Debug\Red.bmp")) Dim buttonBlue As New PushButtonData("Hello Blue", "Hello Blue", assembly, "Hello.HelloBlue") buttonBlue.Image = New BitmapImage(New Uri("D:\Sample\HelloWorld\bin\Debug\Blue.bmp")) Dim buttonGreen As New PushButtonData("Hello Green", "Hello Green", assembly, "Hello.HelloGreen") buttonGreen.Image = New BitmapImage(New Uri("D:\Sample\HelloWorld\bin\Debug\Green.bmp")) ' add 3 stacked buttons to the panel ribbonPanel.AddStackedItems(buttonRed, buttonBlue, buttonGreen) ' add a pull-down button to the panel Dim pulldownButton As PulldownButton = TryCast(ribbonPanel.AddItem(New PulldownButtonData("Hello", "Hello 123")), PulldownButton) pulldownButton.LargeImage = New BitmapImage(New Uri("D:\Sample\HelloWorld\bin\Debug\Hello.bmp")) ' add some menu items to the pull-down button and assign bitmaps to them Dim buttonOne As PushButton = pulldownButton.AddPushButton(New PushButtonData("Hello One", "Hello 123", assembly, "Hello.HelloOne")) buttonOne.LargeImage = New BitmapImage(New Uri("D:\Sample\HelloWorld\bin\Debug\One.bmp")) Dim buttonTwo As PushButton = pulldownButton.AddPushButton(New PushButtonData("Hello Two", "Hello 123", assembly, "Hello.HelloTwo")) buttonTwo.LargeImage = New BitmapImage(New Uri("D:\Sample\HelloWorld\bin\Debug\Two.bmp")) Dim buttonThree As PushButton = pulldownButton.AddPushButton(New PushButtonData("Hello Three", "Hello 123", assembly, "Hello.HelloThree")) buttonThree.LargeImage = New BitmapImage(New Uri("D:\Sample\HelloWorld\bin\Debug\Three.bmp")) Return Result.Succeeded End Function