Search This Blog

Tuesday, June 7, 2016

Clear Validation Error On TextBox TextChanged event WPF

WPF > Validation > ClearInvalid

Removes all ValidationError objects from the specified BindingExpression object.

Example


this.TextChanged += TextBox_TextChanged;

void TextBox_TextChanged(object sender, TextChangedEventArgs e)
{
     Validation.ClearInvalid(((TextBox)sender).GetBindingExpression(TextBox.TextProperty));
}