Remove or Hide a Ribbon Tab

Remove or Hide a Ribbon Tab

basionyecg
Participant Participant
6,056 Views
8 Replies
Message 1 of 9

Remove or Hide a Ribbon Tab

basionyecg
Participant
Participant

Hello,

 

I am familiar with adding a Ribbon Tab Programmatically

 

public static UIControlledApplication UiCtrApp;
public Result OnStartup(UIControlledApplication application)
            {
                UiCtrApp = application;
                UiCtrApp.CreateRibbonTab("New Tab");

                return Result.Succeeded;
            }

but I don’t seem to find a way to remove or hide the tab at a certain point in runtime, How can I do that?

 

Ragards,

Basiony

 

0 Likes
Accepted solutions (2)
6,057 Views
8 Replies
Replies (8)
Message 2 of 9

rosalesduquej
Alumni
Alumni

Hi,

 

I found a post on the Builder Coder which Dynamically Hides and Displays a Ribbon panel. 

 

http://thebuildingcoder.typepad.com/blog/2013/07/dynamically-hide-and-display-a-ribbon-panel.html 

 

Hope this helps,

Cheers,



Jaime Rosales D.
Sr. Developer Consultant
Twitter | AEC ADN DevBlog
Message 3 of 9

basionyecg
Participant
Participant

 

Thanks Jaime , but it seems that it is not the same case for tabs.

 

Regards,

Basiony

0 Likes
Message 4 of 9

eN27
Contributor
Contributor
Accepted solution

Try this one :

 

Autodesk.Windows.RibbonTab      revitRibbonTab = UIFramework.RevitRibbonControl.RibbonControl.FindTab(tabName);
revitRibbonTab.IsVisible = false;

You need also add reference to AdWindows.dll  to have access to things from Autodesk.Windows  namespace;

Message 5 of 9

Revitalizer
Advisor
Advisor
Accepted solution

Hi,

 

there is a workaround using the AdWindows.dll:

 

using Autodesk.Windows;

 

Then, OnStartup, register for ViewActivated event.

 

When triggered, call this function:


private void DisableTab()
{
    Autodesk.Windows.RibbonControl ribbon = Autodesk.Windows.ComponentManager.Ribbon;

    foreach (Autodesk.Windows.RibbonTab tab in ribbon.Tabs)
    {
        if (tab.Title="yourTabTitle")
        {
            tab.IsVisible = false;
        }
    }
}

 

Revitalizer




Rudolf Honke
Software Developer
Mensch und Maschine





Message 6 of 9

Revitalizer
Advisor
Advisor

Didn't see your post, you already provided the solution.

 

Revitalizer




Rudolf Honke
Software Developer
Mensch und Maschine





0 Likes
Message 7 of 9

rosalesduquej
Alumni
Alumni

Oh well yes, using AdWindows.dll it sure can be achieve :). Just remember that this Dll is not supported by Autodesk, so any odd functionality that this may cause, we cannot support it. 

 

Thank you Revitalizer for pointing out the solution 😉 

 

Cheers,



Jaime Rosales D.
Sr. Developer Consultant
Twitter | AEC ADN DevBlog
0 Likes
Message 8 of 9

Revitalizer
Advisor
Advisor

Hey Jaime,

 

eN27 provided the answer first, don't forget 😉

 

 

Rudi




Rudolf Honke
Software Developer
Mensch und Maschine





0 Likes
Message 9 of 9

fernando.pavonC234G
Explorer
Explorer

Thanks for your reply, but where do we find UIFramework?

0 Likes