Open
Description
Describe the bug
- It takes two times to leave
ui:NumberBox
focus for the input value to propagate into binded ViewModel; - Changing to
UpdateSourceTrigger=PropertyChanged
makes it behave like is should've behaved withUpdateSourceTrigger=LostFocus
.
Seems like UpdateSourceTrigger=LostFocus
happens between Text and Value inside the control.
To Reproduce
I made this reproduction:
https://github.com/KillyMXI/wpf-ui-numberbox-issue-repro
- View: Views/Pages/DashboardPage.xaml
- ViewModel: ViewModels/Pages/DashboardViewModel.cs
Expected behavior
- It should not have extra internal propagation step.
- Value and Text should be updated at the same time.
- It should respect
UpdateSourceTrigger
setting.PropertyChanged
- both Text and Value changes notified immediately;LostFocus
- both Text and Value changes notified on lost focus.
Extra:
Invalid value should not override text input. Don't ruin user input.
Invalid state should be telegraphed to the user through validation.
When Text is unparseable - Value should probably be NaN.
Screenshots
What is shown:
ui:TextBox
works as expected;- binding ViewModel string to Text of
ui:NumberBox
works as expected, but Value is out of sync; - binding ViewModel number to Value of
ui:NumberBox
causes extra step needed to fully propagate new value.
OS version
Edition Windows 10 Pro
Version 22H2
OS build 19045.3930
.NET version
<TargetFramework>net8.0-windows</TargetFramework>
WPF-UI NuGet version
<PackageReference Include="WPF-UI" Version="3.0.0" />
Additional context
This is most likely related to:
but observed from the opposite end.
Activity