Remove tool from Ribbon toolbar in C#

This post has 2 Replies | 2 Followers

MRohrer
Points 83
Replied On: Fri, Feb 20 2009 9:20 AM

I am trying to remove a tool from the ribbon toolbar using C#. The code I am using is;

"toolbar_Ribbon.Tools.Remove(tool) 

The error I get states;

"The best overloaded method match for 'Infragistics.Win.UltraWinToolbars.ToolsCollectionBase.Remove(Infragistics.Win.UltraWinToolbars.ToolBase)' has some invalid arguments."

 Could you provide a C# sample code on how to do this? 

Thank you.

 

  • Post Points: 38
Replied On: Mon, Feb 23 2009 3:23 PM

Hi,

Here is a sample that removes an instance tool ("Remove Tool on Ribbon" button code) and also removes the root instance tool ("Remove tool for good" button code). 

The "Remove Tool on Ribbon" button will get rid of ButtonTool2 in the Ribbon's first tab and first tab group.  You should note that the tool still exists in the Tools collection. 

 The "Remove tool for good" button will get rid of ButtonTool2 in the UltraToolbarsManager's Tools collection and as a result remove the instance tool on the Ribbon's first tab, tab group. 

 Further reading if you are interested (found here) has a nice description of root and instance tools (along with the shared props and instance props). 

Matthew Kraft 
Windows Forms R&D Engineer
Infragistics, Inc.

  • Post Points: 40
MRohrer
Points 83
Replied On: Mon, Feb 23 2009 9:40 PM

Thanks, Matthew.  Your sample worked great.

  • Post Points: 5
Page 1 of 1 (3 items) | RSS