I
I
IartanisI2019-06-18 14:05:48
WPF
IartanisI, 2019-06-18 14:05:48

How, in this example, autocomplete, to make it so that the “keydown” key (down arrow) would navigate through the drop-down options?

There is this example of autocomplete, it completely suits me. But the problem is that you can select from the drop-down list only with the mouse. Other control methods do not work. Can you tell me how to add this function or another similar example (I searched, but some are extremely massive, and I can’t figure out others myself).

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman, 2019-07-03
@WNeZRoS

Easiest option:
Replace ScrollViewer with ListBox , and populate its elements instead of StackPanel.
In the TextBox_KeyUp event, if the Down or Up key is pressed, change the ListBox 's SelectedIndex
All the magic with MouseEnter and MouseLeave will not be needed. Instead of MouseLeftButtonUp on the element, you need to handle the SelectionChanged of the ListBox

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question