How can I implement incremental search on a listbox?

前端 未结 4 738
-上瘾入骨i
-上瘾入骨i 2021-01-19 00:19

I want to implement incremental search on a list of key-value pairs, bound to a Listbox.

If I had three values (AAB, AAC, AAD), then a user should be able to select

4条回答
  •  青春惊慌失措
    2021-01-19 00:59

    If I'm interpreting your question correctly, it seems like you want users to be able to start typing and have suggestions made.

    You could use a ComboBox (instead of a ListBox):

    1. Set the DataSource to your list of KeyValuePairs,
    2. Set the ValueMember to "Key" and the DisplayMember to "Value",
    3. Set AutoCompleteMode to SuggestAppend, and
    4. Set AutoCompleteSource to ListItems

提交回复
热议问题