public static void DoSimulateFocusChange()
{
TextBox textBox = Keyboard.FocusedElement as TextBox;
if (textBox != null)
{
BindingExpression be = textBox.GetBindingExpression(TextBox.TextProperty);
if (be != null && !textBox.IsReadOnly && textBox.IsEnabled)
{
be.UpdateSource();
}
return;
}
ComboBox lComboBox = Keyboard.FocusedElement as ComboBox;
if (lComboBox != null)
{
BindingExpression be = lComboBox.GetBindingExpression(ComboBox.TextProperty);
if (be != null && !lComboBox.IsReadOnly && lComboBox.IsEnabled)
{
be.UpdateSource();
}
return;
}
}