I’ve recently been transferring some old VBA ShapeSheet utilities over to a c# add-in for Visio 2010 and hit a problem when trying to add some custom groups to the ShapeSheet Design ribbon tab. Using Ribbon.xml, I was happily able to add groups to either custom tabs or built-in ones such as ‘Home’, but for love nor money couldn’t get anything to show in the ShapeSheet tab.
Chris Hopkins, from the Visio team, kindly set me straight and the solution was in understanding that not all tabs are created equal and that the ShapeSheet Design tab belongs to a set called Contextual Tabs…
Core or contextual
If you’re interested in the general workflow of adapting the ribbon in Visio 2010 then head over to the Customizing the Ribbon in Visio 2010 by Using a Visual Studio 2010 Add-In article on MSDN. What it doesn’t cover directly is the contextual tabs difference. A somewhat abstract hierarchy for Ribbon XML is as follows:
…and as you can see contextualTabs are separate from the standard or core ‘tabs’ collection.
Visio’s contextual set
One very handy resource when dealing with Ribbon XML is a set of Excel spreadsheets that you can download highlighting all of the Office 2010 control ID’s (or relevant idMso). If you look at the Visio one you’ll spot that Visio has four contextual tabs sets:
- TabSetContainerTools
- TabSetInkTools
- TabSetPictureTools
- TabSetShapeSheetTools
The last one was the one I was after and so a fleshed out xml snippet (for the image at the top of this post) might look something like this:
Anyway, I hope this helps out if you find your self scratching your head in the same way I did.
Further reading surrounding Visio ribbon customization, if you’ve not come across them already, includes: