Ribbon Extensibility in Office 2010: Tab Activation and Auto-Scaling
Summary: Tab activation and auto-scaling are added to the extensibility model of the ribbon in the Microsoft Office 2010 Fluent user interface. Explore these features in more detail in this article. (2 printed pages)
Applies to: Microsoft Office 2010
Published: November 2009
Provided by: Frank Rice, Microsoft Corporation
Two frequently requested features from developers who create solutions that use the ribbon in the Microsoft Office Fluent user interface (UI) are tab activation and group auto-scaling. Tab activation enables you to activate a tab (bring a tab to the foreground) on demand. Auto-scaling enables ribbon groups to adapt their layout to best match the horizontal window size.
Setting Tab Activation
In Microsoft Office 2010, you activate a custom tab by using the ActivateTab method of the IRibbonUI object as follows.
To activate the custom tab, expression returns an IRibbonUI object and tabID is a String-type parameter that specifies the custom tab identifier to become active.
You use the ActivateTabMso method for built-in tabs and ActivateTabQ for tabs shared between multiple add-ins. ActivateTabQ also requires an additional String-type parameter that specifies the namespace of the add-in as follows.
Activation only applies to tabs that are visible.
The following is an example of activating the built-in Data tab in Microsoft Excel 2010.
Auto-Scaling of Custom Controls
In Office 2010, you enable auto-scaling by setting the autoScale attribute of the <group> tag to True as follows.
Auto-scaling is set on a per-group basis.
When you enable auto-scaling for a group, and the ribbon is resized horizontally (always from right-to-left), the controls in that group also resize automatically from the normal size (see Figure 1) to a medium size (see Figures 2 and 3) to a smaller size (see Figure4) successively.
Figure 1. Controls shown at normal sized
Figure 2. Controls shown slightly more compressed
Figure 3. Controls shown more compressed
Figure 4. Group shown as a single button
You can specify the icon that appears when the group is compressed to a single button by assigning an image to the group itself.
Tab activation enables you to activate (bring to the foreground) a particular tab on demand. Auto-scaling enables ribbon groups to adapt their layout to best match the horizontal window size. By using these features, you can address scenarios that you could not previously, and improve access to the UI for your customers.
Find more information about the subjects discussed in this article at the following locations.
Acknowledgment: Thanks to my editor, Linda Cannon, for her help in preparing this article for publication.