Ribbon UI changes after DLL loading

Ribbon UI changes after DLL loading

sh-watanabe9SVV8
Explorer Explorer
470 Views
3 Replies
Message 1 of 4

Ribbon UI changes after DLL loading

sh-watanabe9SVV8
Explorer
Explorer

I would like to develop an API with GUI changes, such as a ribbon UI, while refreshing it in the add-in manager.
My understanding is that once all functions are fully loaded, the ribbon UI can only be turned on or off. In other words, I believe it is impossible to change images, etc.

Accepted solutions (1)
471 Views
3 Replies
Replies (3)
Message 2 of 4

Kennan.Chen
Advocate
Advocate

Changing Ribbon UI on the fly is definitely possible. Ribbon UI is WPF underneath, which means you can use the WPF binding to update UI, with the help of AdWindows.dll.

Message 3 of 4

moturi.magati.george
Autodesk
Autodesk
Accepted solution

Hi @sh-watanabe9SVV8,

You can also go through the documentation provided by Revit to make the changes.
https://www.revitapidocs.com/2023/544c0af7-6124-4f64-a25d-46e81ac5300f.htm
https://www.revitapidocs.com/2023/79225f03-1633-3722-15b0-752c91a3740d.htm

Here is a sample you can try to improve

//Get all Ribbons in Revit UI
            Autodesk.Windows.RibbonControl ribbons = Autodesk.Windows.ComponentManager.Ribbon;
            //loop through the Ribbons
            foreach (Autodesk.Windows.RibbonTab ribbon in ribbons.Tabs)
            {
                //Find the specific Ribbon you had created here
                if (ribbon.Title == "Name of Ribbon Title")
                {
                    //Manipulate the ribbon
                    //ribbon.Name = "Tester";
                    //tab.IsVisible = false;

                    //Get all Ribbon Panels
                    //List<RibbonPanel> liste_rp = uiapp.GetRibbonPanels();

                    //Get a specific Ribbon Panels by Ribbon Name
                    List<RibbonPanel> liste_rp = uiapp.GetRibbonPanels(ribbon.Title);
                    //Loop through the panels in the ribbon
                    foreach (RibbonPanel rp in liste_rp)
                    {
                        if (rp.Name == "Name of Ribbon Panel")
                        {
                            //Choose to manipulate the panel
                            //rp.Title = "Test";
                            //rp.Name = "Test";
                            //rp.Visible = false;


                            //Get items in a specific panel
                            IList<RibbonItem> items = rp.GetItems();
                            foreach (RibbonItem item in items)
                            {
                                //Manipulate the items
                                //item.Visible = false;
                            }
                            break;
                        }
                    }                    
                    break;
                }
            }
            




  Moturi George,     Developer Advocacy and Support,  ADN Open
Message 4 of 4

sh-watanabe9SVV8
Explorer
Explorer

hi! @moturi.magati.george 


Thank you for your assistance.

Using your sample code, I managed to rename the RibbonItem(ItemText) successfully.
Now, regarding RibbonItem member, I'm wondering if there's a way to alter its image(icon).

Is that possible?

0 Likes