Gets or sets a custom filter that filters the
ItemsSource while text is being typed in the
AutoCompleteTextBox.
In the following example, every time a new character is typed, every item of the AutoCompleteTextBox will call the IsItemPassFilter method.
Only the items containing two instances of the characters typed in the TextBox will pass the filter & be displayed in the AutoCompleteTextBox. This means that if the letter "a" is typed, only the words containing two instances of "a" will be displayed.
_autoCompleteTextBox.CustomFilterAction = new MyCustomFilterAction();
public class MyCustomFilterAction : ICustomFilterAction
{
public bool IsItemPassFilter( object item, string filterText )
{
return ( (string)item ).Count( x => char.ToLower( x ) == filterText.ToLower()[ 0 ] ) == 2;
}
}
Target Platforms: Windows 11, Windows 10, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2