Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NumericUpDown - Changes to FormatString are not reflected immediately #16556

Closed
pokorpa opened this issue Jul 31, 2024 · 1 comment · Fixed by #16575
Closed

NumericUpDown - Changes to FormatString are not reflected immediately #16556

pokorpa opened this issue Jul 31, 2024 · 1 comment · Fixed by #16575
Labels
bug help-wanted A contribution from the community would be most welcome.

Comments

@pokorpa
Copy link
Contributor

pokorpa commented Jul 31, 2024

Describe the bug

When FormatString binding value is changed, the new format is applied only after focusing or interacting with the control.

To Reproduce

  1. Create NumericUpDown with binding to FormatString.
  2. Change bound value
  3. The content of NumericUpDown stays the same.

Expected behavior

Content of NumericUpDown changes accoring to the new format string immediately.

Avalonia version

11.1.1

OS

Windows 10

Additional context

I believe that the problem is in SyncTextAndValueProperties call in OnFormatStringChanged.
The call should set forceTextUpdate=true, ie.

protected virtual void OnFormatStringChanged(string? oldValue, string? newValue)
{
    if (IsInitialized)
    {
        SyncTextAndValueProperties(false, null, true);
    }
}
@pokorpa pokorpa added the bug label Jul 31, 2024
@maxkatz6 maxkatz6 added the help-wanted A contribution from the community would be most welcome. label Aug 1, 2024
@pokorpa
Copy link
Contributor Author

pokorpa commented Aug 2, 2024

Created PR #16575 with proposed fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug help-wanted A contribution from the community would be most welcome.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants