Just today someone asked me how to create these and I thought it would be appropriate to dedicate blog post to it. What are contextual tab groups? Here is screenshot:

Notice the yellowish Table Tools header over the Design and Layout tabs. That is indicating that these two tabs belong to the Table Tools contextual tab group.

What would you use this for? If you display the Ribbon Tabs based on the current context, say, active MDI Child using our merging or based on current selection, then using the contextual tab groups you can indicate to the user that newly created tabs belong to certain function, like Table Tools in this case.

That helps with visual identification of added functionality to the Ribbon. It becomes much clearer that due to the certain action, like opening new form, tabs were added that are context specific.

To create Contextual Tab Groups you would follow these steps:

  • Select RibbonControl in windows forms designer and make sure that TabGroupsVisible property is set to true
  • Select RibbonTabItem in windows forms designer
  • Select the Group property in Visual Studio.NET Property grid usually located on right hand side
  • Drop down the Group property selector and select New Group
  • Expand the Group property using + sign next to it and change any properties you like, for example GroupTitle which indicates the title of the group, or Color which sets the group background color

Some of the key properties when working with the Contextual Tab Groups are:

  • RibbonControl.TabGroupsVisible which indicates whether the tab groups are visible
  • RibbonControl.TabGroupHeight which specify the height of the group in pixels
  • RibbonControl.TabGroups which is collection of all tab groups created for ribbon control
  • RibbonTabItemGroup.Color which indicates the predefined background color for the tab group
  • RibbonTabItemGroup.GroupTitle which indicates the textual title for the group displayed above the tabs
  • RibbonTabItemGroup.Style that lets you fully customizes the visual style of the group. You can change font, background color, text color etc. This object provides really very wide range of control over appearance.

Last but not least, if you are visual person like me, you will appreciate Video Tutorial that I put together so you can see all this in action and learn how to create Contextual Tab Groups in less than 2 minutes 🙂

DotNetBar is a Windows Forms component for Visual Studio.NET 2005 that helps you create professional user interfaces with ease.

[tags]DotNetBar, Office 2007, Ribbon, Windows Forms, Visual Studio, Components[/tags]

Professional looking applications made easy with DotNetBar for WinForms, Silverlight and WPF User Interface components. Click here to find out more.