I have a textBox which is being used for the Search engine inside my Form as parameter. The KeyDown event on the textBox calls a method on Enter. After that I need the focus to be placed on the same textbox. How can I place the focus on that textBox ?
the code:
private void txtName_KeyDown(object sender, System.Windows.Input.KeyEventArgs e)
{
if (e.Key == Key.Enter)
{
btnSearch_Click(sender, e);
txtName.Focusable = true;
txtName.Focus();
}
}
It seems that is not working. So how can I make this work ?