Skip to main content

ComboBoxItemCollection.Clear() Method

Removes all items from the combo box editor’s item collection.

Namespace: DevExpress.Blazor.Office

Assembly: DevExpress.Blazor.v24.1.dll

NuGet Package: DevExpress.Blazor

Declaration

public void Clear()

Remarks

The following code snippet removes all items from the Font combo box.

<DxRichEdit CustomizeRibbon=OnCustomizeRibbon/>

@code {
    void OnCustomizeRibbon(IRibbon ribbon) {
        RibbonTabCollection tabs = ribbon.Tabs;
        RemoveItemsFromFontComboBox(tabs);
        // ...
    }

    void RemoveItemsFromFontComboBox(RibbonTabCollection tabs) {
        IRibbonTab homeTab = tabs[RichEditRibbonTabNames.Home];
        IBarGroup homeFontGroup = homeTab.Groups[RichEditRibbonGroupNames.HomeFont];
        IBarItem fontNameItem = homeFontGroup.Items[RichEditBarItemNames.FontName];
        if (fontNameItem.Type == BarItemTypes.ComboBox) {
            IBarComboBox fontNameComboBox = (IBarComboBox)fontNameItem;
            fontNameComboBox.Items.Clear();
        }
    }
}
See Also