ComboBox - Buttons
- 3 minutes to read
The DevExpress Blazor ComboBox component allows you to show the Clear button, hide built-in drop-down button, and add custom command buttons.
Clear Button and Placeholder
Set the ClearButtonDisplayMode property to Auto
to show the Clear button when the editor has a non-null value. Users can click this button to clear the editor’s value (set it to null
).
Use the NullText property to display the prompt text (placeholder) in the editor when its value is null
.
<DxComboBox NullText="Select a country..."
Data="@CountryData.Countries"
@bind-Value="@CurrentCountry"
TextFieldName="@nameof(Country.CountryName)"
ClearButtonDisplayMode="DataEditorClearButtonDisplayMode.Auto">
</DxComboBox>
@code {
Country CurrentCountry { get; set; } = CountryData.Countries[1];
}
Note
If you use the EditBoxDisplayTemplate property and need to show the clear button and placeholder, you should also add a DxInputBox object to the template markup.
Hide Built-In Drop-Down Button
Set the ShowDropDownButton property to false
to hide the built-in button that invokes a drop-down menu. If you need a custom button, you can add a new command button.
Add Command Buttons
You can add custom command buttons to the ComboBox. Refer to Command Buttons for more information.
The following code snippet adds the Add Employee button to the ComboBox.