Why deletion of last character in Entry not triggers observableProperty? (MVVM, Maui)
I have an input field where the user can enter numbers. When any number is typed, the model updates successfully, which I can confirm using a breakpoint. However, when there is only one character left and it is deleted, the update does not occur, and the model retains the previous number instead of updating.
Why is this happening, and how can I ensure the model updates correctly when the last character is deleted?
ViewModel
Xaml
<Entry Keyboard= "Numeric" Text= "{Binding Value}" />
2 Replies
what should the value be set to?
your property isnt nullable, so the onpropertychanged wont be thrown becaue validation fails. sadly im not too familiar what maui provides for this case
there is always the possibility to make the property a string instead and to do validation/parsing yourself
Originally I had int?, but with that also was the same case. I changed to string and add a parser with that when the last "number" is deleted it triggers as expected.