private void TextBoxEmail_LostFocus(object sender, RoutedEventArgs e) { if (TextBoxEmail.Text == "") { return; } if (!ValidatorExprensions.IsValidEmail(TextBoxEmail.Text)) { TextBoxEmail.Text += "(Error!)"; TextBoxEmail.BorderBrush = Brushes.Red; TextBoxEmail.Foreground = Brushes.Red; } }
private void TextBoxEmail_GotFocus(object sender, RoutedEventArgs e) { if (TextBoxEmail.Text == "") { return; } TextBoxEmail.BorderBrush = Brushes.Black; TextBoxEmail.Foreground = Brushes.Black; if (!ValidatorExprensions.IsValidEmail(TextBoxEmail.Text)) { TextBoxEmail.Text = ""; } if (TextBoxEmail.Text.Contains("(Error!)")) { TextBoxEmail.Text = TextBoxEmail.Text.Replace("(Error!)", ""); } }