I'm trying to remove the hover state that a user might have on a ComboBoxItem
when this user is using the keyboard arrows to navigate through the items. But, when the user moves his mouse over an item, the hover state / selection state goes to this item.
Right now, with a stock WPF ComboBox
, I found out that there is three states with different combinaisons: focused, hover, selected. For example, in the following screenshot, the item3
is the one that was selected, item5
has the mouse hover state and the item7
is the one with the keyboard focus.
I want the behaviour of my ComboBox to be like this
<!DOCTYPE html>
<html>
<body>
<select>
<option value="Item1">Item #1</option>
<option value="Item2">Item #2</option>
<option value="Item3">Item #3</option>
<option value="Item4">Item #4</option>
</select>
</body>
</html>
- When I enter the drowndown, the "selected" (blue in this case) value is already selected.
- If I mouse over an item, this item becomes the one that is "selected".
- From there, if I use the arrows on my keyboard, the "selected" item is changed and there is no items in the hovered state until I move my mouse again.
I tried using VisualStates
and Trigger
on the Selected and MouseOver states, but it didn't seemed to be working. I also checked and it could be done with EventSetters
but I don't know on which Event
to attach the handler to detect the mouse mouvement on top of a ComboBoxItem
.
Thank you in advance for you help!