lepoco / lepoco/wpfui

NumberBox Increment and Decrement Set the Value After Validation

Open
#1,016 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
C#
Stars
9.6k
Forks
1k
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/Wpf.Ui/Controls/NumberBox/NumberBox.cs at the StepValue function referenced in the issue, and review the ValidateInput, range, and value-setting flow. Reproduce the issue with min and max values configured, then verify that clicking increment or decrement does not set a value outside the range.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
desktop, frontend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.