views:

309

answers:

2

We 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.

Could you please explain and put some code snippet on how to do that ?

Will highly appreciate if anyone can help asap ...

A: 

Sorry to ask such a silly and simple question...

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.

jignesh
A: 

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

Francesco De Vittori