Chapter 15. Working with Contextual Controls

Contextual tabs offer a tremendous boost to the functionality of the new UI. These are specialized tabs that appear when the user is performing a specific task on certain objects. For example, when working with a chart in Excel, a contextual tab provides additional options specific to chart handling. The same goes for tables in Word, and forms and reports in Access.

In this chapter, you learn how to create and implement these specialized tabs, as well as how to modify built-in ones. You also learn how to customize or replace the built-in pop-up menus and how to create your own contextual pop-up menus. Finally, we discuss creating a multilingual UI.

As you are preparing to work through the examples in this chapter, we encourage you to download the companion files. The source code and files can be found on the book's website at

Making Your Items Contextual

Making an item contextual implies that it must react to the context of what is being done, such as manipulating a table or a picture. According to the pure definition of context-sensitive controls, you would need to use a contextual tab collection to carry out the task in the new Office UI. However, this is not always possible or practical, so we will show you some alternatives and workarounds.

This section introduces you to the concept of contextual controls, such as tabs, groups, and general controls.


When it comes to context-sensitive commands, what immediately ...

Get RibbonX: Customizing the Office 2007 Ribbon now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.