If none of the predefined filters suit your needs, the
ItemFilter property of the
AutoCompleteBox allows you to define a custom method for determining whether a suggestion item matches the entered text. This works well in conjunction with the MVVM pattern, as you see in this section.
To add custom filtering to an
AutoCompleteBox, you first create a method that conforms to the
AutoCompleteFilterPredicate delegate, shown here:
bool AutoCompleteFilterPredicate<T>(string search, T item)
Your custom filter method must accept a search string (the text entered by the user) and an item from the list of suggestions (usually defined by the
ItemsSource property of the
AutoCompleteBox), and it must return ...