Back to Devexpress

ComboBoxItemCollection Class

blazor-devexpress-dot-blazor-dot-office-05cd348c.md

latest2.7 KB
Original Source

ComboBoxItemCollection Class

An item collection for a combo box editor displayed on the Rich Text Editor‘s ribbon or toolbar.

Namespace : DevExpress.Blazor.Office

Assembly : DevExpress.Blazor.v25.2.dll

NuGet Package : DevExpress.Blazor

Declaration

csharp
public class ComboBoxItemCollection :
    IEnumerable<IBarComboBoxItem>,
    IEnumerable

The following members return ComboBoxItemCollection objects:

Remarks

The following code snippet creates a custom combobox and add items to it.

razor
<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: ";
    }    
}

Run Demo: Toolbar Customization

Implements

IEnumerable<IBarComboBoxItem>

IEnumerable

Inheritance

Object ComboBoxItemCollection

See Also

ComboBoxItemCollection Members

DevExpress.Blazor.Office Namespace