Skip to main content

IBarComboBox Interface

A combo box editor on the Rich Text Editor‘s ribbon or toolbar.

Namespace: DevExpress.Blazor.Office

Assembly: DevExpress.Blazor.v23.2.dll

NuGet Package: DevExpress.Blazor

Declaration

public interface IBarComboBox :
    IBarItem,
    IBarItemBase

Remarks

The code below demonstrates how to create a custom combobox and add items to it.

<DxRichEdit CustomizeToolbar=OnCustomizeToolbar BarMode=BarMode.Toolbar/>

@code {
    void OnCustomizeToolbar(IToolbar toolbar) {
        BarGroupCollection groups = toolbar.Groups;
        groups.Clear();
        AddFileCommonGroup(groups);
        // ...
    }

    void AddFileCommonGroup(BarGroupCollection groups) {
        IBarGroup fileCommonGroup = groups.Add(RichEditRibbonGroupNames.FileCommon);
        // ...

        // Adds a custom combobox
        IBarComboBox documentFormatComboBox = fileCommonGroup.Items.AddCustomComboBox(2,
            () => documentFormat,
            (value) => Task.FromResult(documentFormat = (DocumentFormat)value)
        );
        documentFormatComboBox.Items.Add("Word Document (*.docx)", DocumentFormat.OpenXml);
        documentFormatComboBox.Items.Add("Rich Text Format (*.rtf)", DocumentFormat.Rtf);
        documentFormatComboBox.Items.Add("Plain Text (*.txt)", DocumentFormat.PlainText);
        documentFormatComboBox.AllowUserInput = false;
        documentFormatComboBox.CssClass = "document-format-combobox";
        documentFormatComboBox.Tooltip = "Change file type.";
        documentFormatComboBox.Text = "Save as type: ";
    }    
}

Add a Custom Combo Box

Run Demo: Toolbar Customization

See Also