Ribbon for WinForms | ComponentOne
Elements / Ribbon Items / ComboBox
In This Topic
    ComboBox
    In This Topic

    A ComboBox is a combination of a single-line text box with drop-down list. The ComboBox item in this is highlighted below:

    Combobox

    The Ribbon ComboBox can be added at design-time using the Ribbon Group Floating Toolbar or RibbonGroup Items Collection Editor. Also, you can customize the look of the Ribbon ComboBox using the Ribbon ComboBox Floating ToolBar. Refer this topic for more information on floating toolbars. Further, the user can add items to the ComboBox using RibbonComboBox Items Collection Editor and RibbonComboBox Menu Items Collection Editor from the Items and MenuItems properties in the Properties Window. For detailed information about collection editors, refer this topic.

    This image below shows the floating toolbar of ComboBox.

    Floating toolbar

    A ComboBox can also be added to the C1Ribbon control through the code using the RibbonComboBox class. This is depicted in the code below:

    ' Add ComboBox ribbon item
    Dim ribbonComboBox As RibbonComboBox = New RibbonComboBox()
    ribbonComboBox.Label = "State"
    ribbonComboBox.TextAreaWidth = 100
    Dim defaultView As RibbonButton = New RibbonButton("Default")
    Dim comapactView As RibbonButton = New RibbonButton("Compact")
    Dim backstageView As RibbonButton = New RibbonButton("BackstageView")
    ribbonComboBox.Items.Add(defaultView)
    ribbonComboBox.Items.Add(comapactView)
    ribbonComboBox.Items.Add(backstageView)
    formatGroup.Items.Add(ribbonComboBox)
    
    //Add ComboBox ribbon item
    RibbonComboBox ribbonComboBox = new RibbonComboBox();
    ribbonComboBox.Label = "State";
    ribbonComboBox.TextAreaWidth = 100;
    RibbonButton defaultView = new RibbonButton("Default");
    RibbonButton comapactView = new RibbonButton("Compact");
    RibbonButton backstageView = new RibbonButton("BackstageView");
    ribbonComboBox.Items.Add(defaultView);
    ribbonComboBox.Items.Add(comapactView);
    ribbonComboBox.Items.Add(backstageView);
    formatGroup.Items.Add(ribbonComboBox);