开发者_如何学运维
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 2 years ago.
Improve this questionWe are creating Excel 2007 AddIn using VSTO. Now we have a scenario where in there are 2 buttons. Button 'A' and Button 'B'. Button 'B' needs to be hidden based on the click on the button 'A'.
But since the ribbon bar is not getting refreshed dynamically we are unable to see the change on the Ribbon Bar.
I heard from some blods we need to use callback methods for the same. If that is so, how can I do that?
Two remarks:
1) in order to "force" a refresh on the ribbon you can call ribbon.Invalidate(); This may be useful if you need to programmatically enable/disable buttons or other items.
2) dynamically hiding/showing buttons in the ribbon is against the Ribbon UI Guidelines, which you must comply. I'm not sure if it applies to Office Add-ins as well (or only to standalone applications), but I would be surprised if that's not the case. You can read more here: http://msdn.microsoft.com/en-us/office/aa973809.aspx
Here is how I solved it:
- Step 1: Make Button "B" visible False
- Step 2: on Click event on Button "A" make it visible true.
I got confused by reading too much, and made simple question a complex one.
精彩评论