Reputation: 570
How implement camel case search (search words with capital letters) in WPF AutoCompleteBox. Example: consider my items source contains "Phone Number" then if we type "pn" in text box it suggest phone number in drop down.
Upvotes: 0
Views: 671
Reputation: 5632
You can set the FilterMode
to custom
and set a ItemFilter
predicate to something similar to:
autoBox.FilterMode = AutoCompleteFilterMode.Custom;
autoBox.ItemFilter = new AutoCompleteFilterPredicate<object>((searchText, obj) =>
(obj as string).Where(x=>Char.IsUpper(x))
.SequenceEqual(searchText.ToUpper()));
Upvotes: 0
Reputation: 2311
Set the item filter property as described here, there is an example at the bottom.
You can implement your logic like they have implemented the function SearchEmployees.
Simply add a check if a string contains an upper case letter of the input return true else return false.
Upvotes: 1