I have a TextBox with a two-way binding on the input. It is setup such that it fails validation if it is empty and displays a tooltip saying that it cannot be empty. My problem is that because it is failing validation, it tries to update the bindings everytime the text box changes (i.e. with every key press). I do not want it to update the source with every key press. I've narrowed it down to this code in the Silverlight 4.0 Tool kit for DataField.cs:
private void OnTextBoxTextChanged(object sender, TextChangedEventArgs e)
{
TextBox textBox = sender as TextBox;
if (textBox != null && (ValidationUtil.ElementHasErrors(textBox) || !this._lostFocusFired[textBox]))
{
this._lostFocusFired[textBox] = false;
ValidationUtil.UpdateSourceOnElementBindings(textBox);
}
}
It is falling into the ValidationUtil.UpdateSourceOnElementBindings() because the element has errors. Is there anyway I can prevent it from doing this?