Home / Community & Support / Knowledge Base / RadControls for WinForms / RibbonBar / Adding and using contextual groups in RadRibbonBar

Adding and using contextual groups in RadRibbonBar

Article Info

Rating: 5

 

Article information

Article relates to

RadControls for WinForms Q4 2006 SP2

Created by

Iordan Pavlov, Telerik

Last modified

March 1st, 2007

Last modified by

Iordan Pavlov, Telerik



HOW-TO
Add and use contextual groups in RadRibbonBar

SOLUTION
There are two ways to add a contextual group to a ribbon bar.

SOLUTION 1
The first and definitely easier way is to use in place editing:



Simply click, type in the name and press Enter to add a contextual group.

SOLUTION 2
The second way is by editing the ContextualTabGroups collection of the ribbonbar with the collection editor:


 
The collection editor can also be used to remove contextual groups.

Now we can assign some tabs to our contextual groups.

This can be done in two ways:
  • The first and easier way is just using drag and drop. Just grab the tab you want placed in the contextual tab and then drop it on the group you want. You can event move tabs between groups that way.
  • The second being editing the CommandTabsCollection of a ribbonbar and selecting a contextual group to assign the selected tab to
     

     

Now when we have contextual groups with tabs assigned to them we can write the code to show or hide them in run time depending on some context:

this.contextualTabsSelection.Visibility =
(this.richEditorToolWindow.Document.SelectionLength > 0) ? ElementVisibility.Visible : ElementVisibility.Collapsed;

Comments

If you'd like to comment on this KB article, please, send us a Support Ticket.
Thank you!

Please Sign In to rate this article.