Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
225
How to disable "Add to Quick Access Toolbar" option for a tool in a particular ribbon tab?
posted

I have added a Ribbon Tab "Home", "Tools" and "Help". Inside each tab i have many groups. The requirement is that i need to add that tools that is present in "Tools" Tab to the Quick Access Toolbar only not the tools from "Home" and "Help". Office2007UICompatibility is set to false. When they right-click i want to disable "Add to Quick Access Toolbar" for the tools that is present in the "Home" and "Help" tab. In the "BeforeToolbarListDropdown" event is there an option to check which tab does the tool belong to?  Please help me out?

Thanks

Rajagopalan.

  • 370
    Suggested Answer
    posted

     

     

    Hi Rajagopalan,

    To get the ribbonTab the tool belongs to you can check the owner property of the tool. If this is a ribbonGroup you can get RibbonTab from it. This can be done using the following piece of code:

     

     private void ultraToolbarsManager1_BeforeToolbarListDropdown(object sender, BeforeToolbarListDropdownEventArgs e)

            {

                ToolBase tool = e.Tool;

                if (tool != null)

                {

                    Object owner = tool.Owner;

                    RibbonGroup group = owner as RibbonGroup;

                    if (group != null)

                    {

                        RibbonTab tab = group.Tab;

                        // Check for tab.Caption property and place the desired logic here}

                    }

                }

            }

     

     

    Thanks

    Vaibhav