WPF: Editable ComboBox; how to make search/auto-fill functionality case sensitive?
Say I have a ComboBox
, like so:
<ComboBox IsEditable="True" Height="30">
<ComboBoxItem>robot</ComboBoxItem>
<ComboBoxItem>Robot</ComboBoxItem>
</ComboBox>
If a user comes along and starts by typing a lower-case r into that ComboBox
when it is empty, the ComboBox
predictably auto-fills itself with the word robot. Great.
Now the same user comes along and starts typing an up开发者_开发知识库per-case R into that ComboBox
when it is again empty. Unpredictable, the ComboBox
auto-fills itself with the lower-case word robot. Not great. I desperately want it to auto-fill itself with Robot, but WPF does not seem to want to smile down upon me.
No matter what you do (CAPS lock, shift+key), the ComboBox
will always auto-fill with the lower case robot, provided that the lower case robot precedes the upper case Robot in the ComboBox's
items collection.
Is there any way to prevent this? This behavior is maddening and makes for an absolutely abysmal user experience.
In .Net 4 you can set IsTextSearchCaseSensitive=True on the ComboBox (or indeed any ItemsControl)
精彩评论