Skip to content

NumberBox delayed value propagation after keyboard input #945

Open
@KillyMXI

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 with UpdateSourceTrigger=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

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

NumberBoxIssue

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions