There is a button which is clicked programmatically with code below but it stays as focused (I am not sure with terminology though). How can I get rid of that?
private void txt_addRemove_KeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.Return)
{
btn_BC_add.RaiseEvent(new RoutedEventArgs(Button.ClickEvent));
}
}
Apart a fact that really wired to call a
ButtonClick. What you should do, instead, at least define aCommand, associate it to a button, and from this code do not callRaiseEvent, but callCommandassociated to that button. In practise you call a function.What about a focus, should be enough to set esplicitly a focus to some other control on your view.
Hope this helps.