Skip to main content
All docs
V25.2
  • DxSpinEdit<T>.ValueChanging Event

    Fires when a user is changing the Spin Edit’s value. Use this event to validate/cancel user input.

    Namespace: DevExpress.Blazor

    Assembly: DevExpress.Blazor.v25.2.dll

    NuGet Package: DevExpress.Blazor

    Declaration

    [Parameter]
    public Action<ParameterValueChangingEventArgs<T>> ValueChanging { get; set; }

    Event Data

    The ValueChanging event's data class is ParameterValueChangingEventArgs<T>. The following properties provide information specific to this event:

    Property Description
    NewValue Gets or sets the new value being assigned to the parameter.
    OldValue Gets the current parameter value.

    Remarks

    The ValueChanging event fires before a new value is applied to the editor (before the ValueChanged event). You can use this event to validate/cancel user input.

    The following code snippet automatically formats numbers and handles the ValueChanging event to limit the value range (1 - 100). The current value is updated via two-way binding (@bind-Value).

    <DxSpinEdit @bind-Value="@Amount"
                ValueChanging="@OnValueChanging"
                DisplayFormat="N0">
    </DxSpinEdit>
    
    <div class="mt-2">
        <span>Current amount: @Amount</span>
    </div>
    
    @code {
        int Amount { get; set; } = 50;
    
        private void OnValueChanging(ParameterValueChangingEventArgs<int> e) {
            if (e.NewValue < 1 || e.NewValue > 100) {
                e.NewValue = e.OldValue;
            }
        }
    }
    

    Note

    The Spin Edit also supports numeric masks that allow you to define the input format.

    See Also