I have an entry field that I need to validate to be non empty and a valid e-mail.
I used MAUI toolkit behaviors this way:
<Entry x:Name="Email" MaxLength="50" Placeholder="Correo electrónico">
<Entry.Behaviors>
<toolkit:MultiValidationBehavior
InvalidStyle="{StaticResource InvalidEntryStyle}"
ValidStyle="{StaticResource ValidEntryStyle}"
Flags="ValidateOnValueChanged">
<toolkit:EmailValidationBehavior
DecorationFlags="Trim,NullToEmpty"
Flags="ValidateOnValueChanged"
MinimumLength="1"
MaximumLength="50"
toolkit:MultiValidationBehavior.Error="Debes ingresar el correo electrónico de forma correcta." />
</toolkit:MultiValidationBehavior>
</Entry.Behaviors>
</Entry>
The problem if nothing is entered in the field, Email.Text
is null (even when I placed NullToEmpty
decoration flag). In that case, the validation is successful.
when I add a character and then delete it, Email.Text
is empty and the validation failed.
How can I handle this?