I have a textbox and a listbox. The listbox shows search suggestions for the textbox. I want to highlight the first listbox item when user presses down arrow when the textbox is focused. Similarly, the textbox should be focused back when the user is as the first element on the listbox and presses the up arrow.
I am using the following code for KeyBindings:
<KeyBinding Key="Down" Command="{x:Static local:SearchView.ApplicationShortCutsCommand}" CommandParameter="{x:Static common:SearchViewCommands.MoveToSuggestions}" />
<KeyBinding Key="Up" Command="{x:Static local:SearchView.ApplicationShortCutsCommand}" CommandParameter="{x:Static common:SearchViewCommands.MoveToQuery}" />
Other keys such as Esc and Enter work fine, although this one doesn't work at all (the associated event isn't fired).
Any suggestions?
The events associated with ListBox up and down have priority. I ended up using shift up/down instead because there are so many event consumers that use the up and down events.
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