wpfui icon indicating copy to clipboard operation
wpfui copied to clipboard

NumberBox Increment and Decrement Set the Value After Validation

Open c0nstexpr opened this issue 1 year ago • 0 comments

Describe the bug

Increment and decrement button in NumberBox invoke StepValue function. It validates input before increment or decrement.

        // Before adjusting the value, validate the contents of the textbox so we don't override it.
        ValidateInput();

        var newValue = Value ?? 0;

        if (change is not null)
        {
            newValue += change ?? 0d;        // <--------- increment or drcement happens here
        }

        SetCurrentValue(ValueProperty, newValue);        // <--------- value set here

To Reproduce

Use NumberBox with max and min range set. Click increment or decrement button to set the value out of range.

Expected behavior

Value should not be set out of range

Screenshots

No response

OS version

Same as repo

.NET version

Same as repo

WPF-UI NuGet version

Same as repo

Additional context

No response

c0nstexpr avatar Mar 25 '24 02:03 c0nstexpr