void Bindable_Unfocused(object sender, FocusEventArgs e) { string textValue = ((Entry)sender).ValidatedText(); bool isValid = IsRequired ? !string.IsNullOrWhiteSpace(textValue) : true; IsValid = Validators.CpfCnpjValidator(textValue) && isValid; ((Entry)sender).TextColor = IsValid ? DefaultColor : ErrorColor; }
void Bindable_Unfocused(object sender, FocusEventArgs e) { bool IsValid = Validators.CpfCnpjValidator(((Entry)sender).ValidatedText()); ((Entry)sender).TextColor = IsValid ? DefaultColor : Color.Red; }