
Hi Members,
I am using BindingSource.UpdateTarget() method on property gird's KeyBoardLostfocus Event to Undo the textbox Values and its working fine. But properties on which we have implmented any validation (e.g. numeric input validation) this method fails. This method unable to undo the the value of those properties on ESC key press.
private void PropertyGrid_LostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e)
{
KeyboardDevice keyboardDevice = e.KeyboardDevice as KeyboardDevice;
if (keyboardDevice != null)
{
if (keyboardDevice.IsKeyDown(Key.Escape))
{
TextBox textBox = e.OriginalSource as TextBox;
if (textBox != null)
{
BindingExpression bindingExpression = (textBox).GetBindingExpression(TextBox.TextProperty);
if (bindingExpression != null)
{
bindingExpression.UpdateTarget();
}
}
}
}
}
Any one any suggestions ?
Regards
Pankaj