2027 Method
Changes 0
M

UIControlledApplication.CreateRibbonTab

Description:
Creates a new tab on the Revit user interface.
Remarks:
This method will create a custom tab at the end of the list of static tabs. If multiple tabs are added, they will be shown in the order added. This method is not supported in Macros.
public virtual void CreateRibbonTab(
	string tabName
)
  • String
    tabName
    The name of the tab to be created.
public Result OnStartup(UIControlledApplication application)
{
    // Create a custom ribbon tab
    String tabName = "This Tab Name";
    application.CreateRibbonTab(tabName);

    // Create two push buttons
    PushButtonData button1 = new PushButtonData("Button1", "My Button #1",
        @"C:\ExternalCommands.dll", "Revit.Test.Command1");
    PushButtonData button2 = new PushButtonData("Button2", "My Button #2",
        @"C:\ExternalCommands.dll", "Revit.Test.Command2");

    // Create a ribbon panel
    RibbonPanel m_projectPanel = application.CreateRibbonPanel(tabName, "This Panel Name"); 

    // Add the buttons to the panel
    List<RibbonItem> projectButtons = new List<RibbonItem>();
    projectButtons.AddRange(m_projectPanel.AddStackedItems(button1, button2));

    return Result.Succeeded;
}