I have a LostFocus Event on my textbox, but usually when pressing the Tab key what happens is, the "LostFocus" event triggers, and the next control gets focus. i want to keep focus on the textbox (Assuming an input error happened) instead of moving focus to the next control.
i've tried setting the e event to handled, but nothing changed.
private void phone(object sender, RoutedEventArgs e)
{
TextBox text = (sender as TextBox);
if (text.Text == "") return;
else if (text.Text.Length > 10 || text.Text.Length < 10)
{
MessageBox.Show("Valid Input");
select(sender);
}
}
This is the event i'm trying to use, but as i said, the focus moves to the next control (which is wrong).