-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Entry bound to a double casts values too early, preventing small negative decimal entries #30181
Copy link
Copy link
Open
Labels
area-controls-entryEntryEntryplatform/androidplatform/ioss/triagedIssue has been reviewedIssue has been revieweds/verifiedVerified / Reproducible Issue ready for Engineering TriageVerified / Reproducible Issue ready for Engineering Triaget/bugSomething isn't workingSomething isn't working
Milestone
Description
Description
When using a numeric entry bound to a double, with a negative decimal entry, any value equivalent to 0 will convert to 0, which makes it difficult to type small numbers. I noticed this behavior particularly while writing -0.01.
IE while I'm typing -0.01 in an entry that is bound to a double, I type -0.0 and then 1. However the -0.0 becomes 0. So I end up typing 01, which is converted to 1.
Steps to Reproduce
- Simplest is to run the linked example repo.
- Alternatively, create a new app by choosing Create a File > New .NET MAUI App
- Add a 'Entry' with a double bound to the text, like so:
<Entry Keyboard="Numeric" Text="{Binding NumericValue}"/>
- Add a bindable viewmodel by following the Data binding and MVVM
tutorial. - Add a bindable Numeric value to your page. I'm using the ObservableProperty attribute to make the binding simpler
[ObservableProperty] double? numericValue; - Run your app
- Type -0.01 in your entry
Expected outcome: The value -0.01 is displayed
Actual outcome: The value 1 is displayed
Link to public reproduction project repository
https://github.com/TrueMoniker/Maui_BugDemo_EntryWithDouble
Version with bug
9.0.0 GA
Is this a regression from previous behavior?
No, this is something new
Last version that worked well
No response
Affected platforms
iOS, Android
Affected platform versions
Unknown
Did you find any workaround?
Yes. In the linked repo I provide a work around control in NumericEntry.cs
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area-controls-entryEntryEntryplatform/androidplatform/ioss/triagedIssue has been reviewedIssue has been revieweds/verifiedVerified / Reproducible Issue ready for Engineering TriageVerified / Reproducible Issue ready for Engineering Triaget/bugSomething isn't workingSomething isn't working