The WPF ComboBox doesn't select item when you hit Tab Key. You have to either hit "Enter" or click on the item with your mouse to select it!
This is how I expect it to work:
In reality, it cycles through all of the ComboBoxItems in the ComboBox when you hit the tab key.
In case anyone comes here looking for an example (as I was,) here is the contents of a KeyEvent event handler that works for me:
if (e.Key == Key.Tab || e.Key == Key.Enter)
{
var comboBox = sender as ComboBox;
var newValue = (e.OriginalSource as ComboBoxItem)?.DataContext;
if (newValue != null)
{
comboBox.SelectedItem = newValue;
}
comboBox.MoveFocus(new TraversalRequest(FocusNavigationDirection.Next));
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With