Reverse Filtering in AutoCompleteBox in Windows Phone

The AutoCompleteBox in Silverlight ToolKit for Windows Phone lets you perform the custom logic to display the list of Suggestions matching the typed characters .

For example , you could use the write your logic to show the suggested words in reverse order .

Assume , you have a list of Suggested word as Tennis , when the user types si , the Tennis as suggestion might be required to be shown and this blog post will explain how to that …

The AutoCompleteBox has the property ItemFilter which accepts a custom method that will be used to filter the suggested words based on our own logic .

The ItemFilter is of delegate and accepts 2 parameters – one is the search string and other is the item to be compared with . This returns true is the word matches .

Below is the sample sourcecode to do the reverse filtering in the AUtoCompleteBox in Windows Phone .

public partial class MainPage : PhoneApplicationPage


// Constructor

public MainPage()




private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e)


autoCompleteBox1.ItemsSource = new Sports();

autoCompleteBox1.MinimumPrefixLength = 2;

autoCompleteBox1.ItemFilter = ReverseFilter;


private bool ReverseFilter(string SearchString, object Lst)


if (Lst != null)


string s = SearchString.ToString();

char[] arr = s.ToCharArray();


if (Lst.ToString().ToLower().EndsWith(new string(arr)))

return true;


return false;



class Sports : List<string>


public Sports()





Add("Table Tennis");


Add("Base Ball");





Pin It

Leave a Reply

Your email address will not be published. Required fields are marked *