Back to Devexpress

Command Buttons

blazor-404267-components-data-editors-command-buttons.md

latest3.4 KB
Original Source

Command Buttons

  • Jan 08, 2026
  • 3 minutes to read

DevExpress Blazor editors display built-in command buttons that allow users to open a drop-down, increase/decrease the value, or clear the edit box content.

You can use Show***Button properties to hide these buttons.

You can also customize default command button or add custom buttons to editors. Follow the steps below.

  1. Add the <Buttons></Buttons> tag to the editor’s markup to define the Buttons collection.

  2. Fill the Buttons collection. This collection renders specified buttons in the order they appear in the markup.

  3. Set up button properties to customize the buttons:

Buttons are displayed in an editor in the following order:

  • The “Clear” button
  • Custom buttons and customized default buttons (in the same order as they appear in markup)
  • Built-in buttons

Run Demo: Editors - Command Buttons

Examples

Hide Built-in Button

The following code snippet hides the built-in spin buttons in the Spin editor.

razor
<DxSpinEdit Value="15" ShowSpinButtons="false"></DxSpinEdit>

Customize Default Button

The following code snippet hides the built-in spin buttons, adds new spin buttons, and specifies their position.

razor
<DxSpinEdit Value="15" ShowSpinButtons="false">
        <Buttons>
            <DxSpinButtons Position="EditorButtonPosition.Left"/>
        </Buttons>
</DxSpinEdit>

Add Custom Button

The following code snippet adds a custom currency button to the right of the default spin buttons:

razor
@using System.Globalization

<DxSpinEdit @bind-Value="@Price"
            Mask="@NumericMask.Currency"
            ShowSpinButtons="false">
        <Buttons>
            <DxSpinButtons />
            <DxEditorButton IconCssClass="@($"editor-icon {CurrencyButtonIconClass}")"
                            Tooltip="Change currency"
                            Click="@OnChangeCultureInfoButtonClick"
                            CssClass="dx-demo-editor-width" />
        </Buttons>
        <ChildContent>
            <DxNumericMaskProperties Culture="MaskCultureInfo" />
        </ChildContent>
</DxSpinEdit>

@code{
    double Price { get; set; }
    string CurrencyButtonIconClass { get; set; } = "editor-icon-euro";
    CultureInfo MaskCultureInfo { get; set; } = CultureInfoItems[0];
    static CultureInfo[] CultureInfoItems { get; set; } = {
            CultureInfo.GetCultureInfo("en-US"),
            CultureInfo.GetCultureInfo("de-DE")
    };
    void OnChangeCultureInfoButtonClick() {
        var isCurrentCultureUs = MaskCultureInfo.Equals(CultureInfoItems[0]);
        MaskCultureInfo = isCurrentCultureUs ? CultureInfoItems[1] : CultureInfoItems[0];
        CurrencyButtonIconClass = isCurrentCultureUs ? "editor-icon-dollar" : "editor-icon-euro";
    }
}
css
.dx-demo-editor-width {
    max-width: 320px;
    width: 100%;
}

YouTube video