[Fixed] RadAutoCompleteBox disable autofill on tab key pressed

So in this post, I will show how we can disable the auto-fill of RadAutoCompleteBox when tab key pressed.

This is the best example if you want to auto-fill when the user selects an item from the auto fill or press enter. When press tab it should skip the auto fill and move to next control.

Please find below code which will work like charm.

private void txtUserName_PreviewKeyDown(object sender, KeyEventArgs e){var box = (RadAutoCompleteBox)sender;if (e.Key == Key.Tab && box.IsDropDownOpen){var textBox = box.ChildrenOfType<RadWatermarkTextBox>().FirstOrDefault();if(textBox != null){textBox.MoveFocus(new TraversalRequest(FocusNavigationDirection.Down));}e.Handled = true;}}

The above code worked like charm for me as I was facing the same issue. I hope it will work for you as well.

Happy Coding…!

Posted by | View Post | View Group