Ribbon Contextual Tab
- 2 minutes to read
Contextual tabs are displayed in addition to normal tabs, as they provide end-users with commands that are relevant only within a specific application context.
Our Ribbon implementation allows you to declare any number of application contexts and activate them as necessary in response to end-user actions. For example, you can activate contexts based on the currently selected object in a document or the current step in a multi-stage process.
Visually, contextual tabs are represented by the following elements:
Labels displayed within an application’s title bar.
Tabs displayed below corresponding labels.
To display a contextual tab, do the following:
Derive your form from TdxRibbonForm.
Activate the Ribbon’s SupportNonClientDrawing option.
Create a context within the Ribbon’s Contexts collection.
Associate any number of tabs with the created context via a tab’s Context property.
Assign the context’s Caption and Color properties to specify the label text and the gradient color used to fill the background of a label, and contextual tabs associated with this context.
To activate the context, call its Activate method or set its Visible property to True. As a result, the corresponding label and contextual tabs will be shown within the Ribbon. End-users can then click the contextual tab label to select the first visible tab associated with this context.
As with normal tabs, contextual tabs are represented by TdxRibbonTab objects that can be accessed via the Ribbon’s Tabs property.