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
610
GetToolById() and remove ribbon tool
posted

Hi,

I have two questions about ribbon.

1. In my app, I created ribbon tabs, groups. Later some ButtonTool controls were added to the groups dynamically. I used RibbonGroup.Items.Insert() to add buttons, do I need to register buttons additionally? They show fine on ribbon, but the reason I am asking is that I noticed I got null when calling ribbon.GetToolById() by giving some button IDs, some return fine. However, if I programmatically loop through ribbon components, I got all buttons, as I can see from the UI, I don't know why some are not registered by ribbon.

2. Put question 1 aside, I need to remove some buttons and add them back. When I remove, I use RibbonGroup.Items.Remove(), they do get disappeared from UI, and when I programmatically loop over ribbon components, they are gone, that's right. However, if later I add some buttons back, I got error like "Tool with Id 'UserQueryRunDropDown' already exists. Cannot add multiple tool instances with the same Id." So I run GetToolById on ribbon before I add button, I do see they are still registered with ribbon, that's wrong, how do I unregister the buttons besides removing them from item collection?

Thanks for your help,

Yu

Parents Reply Children