C#C
C#10mo ago
Zoli

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
[ObservableProperty]
private int _value;

// TODO when delete the last value, it should trigger to set the model value
partial void OnValueChanged(int value)
{
    _model.Value = value;
}


Xaml
<Entry Keyboard= "Numeric" Text= "{Binding Value}" />
Was this page helpful?