I'm trying to use TextBoxMask from WindowsCommunityToolkit but i have some strange behaviors. XAML code :
<TextBox extensions:TextBoxMask.Mask="99/99/9999"
Text="{Binding PatientItem.StringBirthDate, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
PatientItemViewModel code :
private string _StringBirthDate;
public string StringBirthDate
{
get { return _StringBirthDate; }
set
{
DateTime birthDateValue;
if (!String.IsNullOrEmpty(value) && DateTime.TryParse(value, out birthDateValue))
{
this.CalculateAgeValue(birthDateValue);
this.BirthDate = birthDateValue;
SetProperty(ref _StringBirthDate, value);
}
}
}
When i start from en empty input, i have no problems. Problems appeares when i open a page to edit data : PatientItem.StringBirthDate is set with "18/02/1952" value.
When i display my page, everything seems good :
But if click on cross to clean textbox, or if i use backspace keyboard touch, only last letter dissapear, and after that moment, if i tap anything on keyboard, some strange behviors appear (number not replaced, cursor do not move forward, etc...)
Do you have any idea to improve my code ? Is there a known problem with text binding used with mask ?
EDIT : video to show more explicitely my problem :
It seems that TextBoxMask call set method with strange values :