Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I've got a ComboBox in WPF that I've mucked around with quite a lot (it has a custom template and a custom item template). I've got it to the point now where it is working pretty much how I want it, except that when I type into the ComboBox it is doing the filtering for me, but only filters assuming what I type starts the name of the item in the ComboBox.

For example if I have an item in the ComboBox called "Windows Media Player" it will only find it if I start typing "Windows Media..." and it won't find it if I start typing "Media Play...". Is there any way around this? Can I set a property somewhere to tell it to search in the whole string rather than just using StartsWith()?

If not, what would be the best way to go about making it do this by myself? Is there some way to take the original control and basically just change the call to StartsWith() to a call to Contains(), or would I have to go far more low-level?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
627 views
Welcome To Ask or Share your Answers For Others

1 Answer

The combobox now supports autocomplete, just make sure in the xaml for the combobox put

IsEditable="True"

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...