You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a Textbox that binds to a long? property in the view model.
I would like that if the TextBox is empty, to set the value of the property to null. But when the TextBox is empty, the property in the view model is not changed, it keeps the last digit that the TextBox had.
I would like to have null when the TextBox is empty.
I was trying to intercept the prperty changed event in this way:
[ObservableProperty]
long? _myProperty;
partial void OnMyPropertyChanging(long? value)
{
Console.WriteLine($"Name has changed to {value}");
_myproperty = value;
}
However the behaviour is not very good. When I write this secuence in the TextBox I get this behaviour:
1.- Write 5. I get 5 as value.
2.- Delete 5, the method is not execute
3.- Write 5, the method is not execute
4.- Write 5, the value of the method is 55
How could I bind to a long? property?
Thanks.
The text was updated successfully, but these errors were encountered:
I have a Textbox that binds to a long? property in the view model.
I would like that if the TextBox is empty, to set the value of the property to null. But when the TextBox is empty, the property in the view model is not changed, it keeps the last digit that the TextBox had.
I would like to have null when the TextBox is empty.
I was trying to intercept the prperty changed event in this way:
However the behaviour is not very good. When I write this secuence in the TextBox I get this behaviour:
1.- Write 5. I get 5 as value.
2.- Delete 5, the method is not execute
3.- Write 5, the method is not execute
4.- Write 5, the value of the method is 55
How could I bind to a long? property?
Thanks.
The text was updated successfully, but these errors were encountered: