ComponentOne Ribbon for WinForms
C1Ribbon (Classic) Task-Based Help / Adding Ribbon Items / Adding a Group to the Ribbon Tab
In This Topic
    Adding a Group to the Ribbon Tab
    In This Topic

    To add a group to the Ribbon tab, you can use the smart designer, collection editor, or add code. Each option is described below.

    To Add a Ribbon Group Using the Smart Designer

    Complete the following steps:

    1. Select the tab that you want to add a new group to. For steps on creating a new tab, see the Adding a Tab to the Ribbon topic.
    2. Click the tab to activate it and enable the tab's floating toolbar:
    3. From the tab's floating toolbar, click the Actions drop-down button.
    4. Select Add Group. This adds a new group to the tab.
    5. To edit the label, click the group text so that it is highlighted. Enter a new group name, for example, Font.
    6. Press ENTER or click outside the editing box to accept the change.
    7. Build on the group by adding items to the Ribbon group.

    To Add a Ribbon Group Using the RibbonGroup Collection Editor

    Complete the following steps:

    1. Select the tab that you want to add a new group to. This activates the tab.
    2. From the RibbonTab's Properties window, select the Groups property and click on the ellipsis button next to the (Collection).

      The RibbonGroup Collection Editor appears.
    3. From the collection editor, click the Add button. A new group is added to the tab; the new group is listed in the Members list.

      With the new group highlighted, you can edit the properties through the Properties list.
    4. Locate the RibbonGroup.Text property from the Properties list, and change the text to Font.
    5. Click OK to close the collection editor.

    To Add a Ribbon Group Programmatically

    To add a RibbonGroup to the RibbonTab, add the following code to your project:

    To write code in Visual Basic

    Visual Basic
    Copy Code
    Imports C1.Win.C1Ribbon
     
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        ' Add a tab to the Ribbon
        Dim RibbonTab2 As RibbonTab = New RibbonTab()
        ' Label the tab
        RibbonTab2.Text = "Write"
        C1Ribbon1.Tabs.Add(RibbonTab2)
     
        ' Add a group to the Write tab
        Dim RibbonGroup2 As RibbonGroup = New RibbonGroup()
        ' Label the group
        RibbonGroup2.Text = "Font"
        RibbonTab2.Groups.Add(RibbonGroup2)
    End Sub
    

    To write code in C#

    C#
    Copy Code
    // type the using directive for the namespace
    using C1.Win.C1Ribbon;
     
    private void Form1_Load(object sender, System.EventArgs e)
    {
        // Add a tab to the Ribbon
        RibbonTab RibbonTab2 = new RibbonTab();
        // Label the tab
        RibbonTab2.Text = "Write";
        c1Ribbon1.Tabs.Add(RibbonTab2);
     
        // Add a group to the Write tab
        RibbonGroup RibbonGroup2 = new RibbonGroup();
        // Label the group
        RibbonGroup2.Text = "Font";
        RibbonTab2.Groups.Add(RibbonGroup2);
    }
    

    Note: If your RibbonGroup.Text property is set to a value that is longer than the contents of the RibbonGroup, you can set the TrimLongCaption property to True to trim the caption to the same length as the RibbonGroup.