`CoerceValueCallback` call after source updated causes source got a wrong value
- Dominant language
- C#
- Stars
- 7.7k
- Forks
- 1.3k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 61
Description
### Description
I'm writting a `NumericUpDown` control, when user click up/down button, the `Value` will increase or decrease, but limit by MaxValue/MinValue in `CoerceValueCallback`, when Value and MinValue is 0, click down button will cause Value be -1, and source got -1, and then, CoerceValueCallback make value to 0, but source still -1. why the CoerceValueCallback called after source updated?? it should be a guard, every change should call it first.
### Reproduction Steps
demo here.
[WpfNumericUpDown.zip](https://github.com/user-attachments/files/29952958/WpfNumericUpDown.zip)
### Expected behavior
all change respect `CoerceValueCallback`
### Actual behavior
`CoerceValueCallback` not respected
### Regression?
_No response_
### Known Workarounds
_No response_
### Impact
_No response_
### Configuration
wpf 9.0-windows
### Other information
_No response_
Contributor guide
Research direction
Start with the attached WpfNumericUpDown.zip and reproduce the behavior under WPF 9.0-windows. Trace the Value update and CoerceValueCallback ordering, including when the binding source receives -1; done means changes consistently respect the coercion and the source does not retain the uncoerced value.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100