Question

BindingSource.UpdateTarget() Method giving problems

Posted 2 years ago by Avatar Pankaj Sood

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


Comments (1)

Posted 2 years ago by Actipro Software Support - Cleveland, OH, USA

Hi Pankaj,

If you can please put together a small sample project that reproduces your issue and email it over then we can take a closer look. Be sure to remove any executables or change the extension of the zip file to ensure it gets past our email filters.


Actipro Software Support
Information The latest build of this product (2014.1 build 0602) was released 1 month ago, which was after the last post in this thread.

Add a Comment

Please log in to a validated account to post comments.