Reputation: 1803
I need this WPF ComboBox as a dropdown where user cannot enter text like textbox but still be able to search via typing text.
I set IsEditable = false and IsTextSearchEnabled = true and it works.
But the problem is that lets say a user is searching for text "Japan". User start text input into the combo with "J". Some items starting with "J" appear in the filtered list of the drop down panel. Now if user waits for 3-4 seconds and then types "a" (to complete typing "Japan"), the filtered list will rather move to items starting with "a".
It should rather search for "Ja" but it searches for "a" and discards "J".
Any ideas how do I fix this behavior?
Upvotes: 3
Views: 1010
Reputation: 3285
In short, I don't think you can (easily). See this post:
What it boils down to is that internally ComboBox
is using a built-in class called TextSearch
. In this class the timeout interval is hard-coded and is not publicly accessible, so you can not change this behaviour.
However, you might have some luck by implementing your own control that inherits from ComboBox
and provides an override of the protected members OnTextInput
and OnKeyDown
. In here, you could implement your own searching logic and own timeout (which could be exposed as a DependencyProperty
and hence configurable from within XAML).
Upvotes: 2