If you have access to the Binding
object, you could set its UpdateSourceTrigger
property to Explicit
, which will prevent automatic updates.
EDIT
Perhaps something like this
UpdateSourceTrigger old;
protected override void OnGotFocus(RoutedEventArgs e)
{
Binding b = BindingOperations.GetBinding(textBox1, TextBox.TextProperty);
old = b.UpdateSourceTrigger;
b.UpdateSourceTrigger = UpdateSourceTrigger.Explicit;
}
protected override void OnLostFocus(RoutedEventArgs e)
{
Binding b = BindingOperations.GetBinding(textBox1, TextBox.TextProperty);
b.UpdateSourceTrigger = old;
}
Of course, this is short form, without any null checking etc.