Text Searching in Silverlight 5 ComboBox and ListBox

Do you know that, we can now search text present in ComboBox and ListBox? This feature was not available in earlier version of Silverlight. To implement it, we had to write custom behavior. Now if you are using Silverlight 5, you can easily use this feature without writing any piece of code.


In this Tip we will discuss about it. We don't have to add any extra code, because it is now the default behavior of those control. Read to know more.



This post is a small tips & tricks to let you know that, you can find the behavior of searching in-built in your ComboBox and ListBox control. To see a demo of it, create a Silverlight Project and add one ComboBox and one ListBox in the XAML page. Add some records inside them or fetch them from the service or code behind.


Now, run your application and click on the combo box to open the dropdown menu. Start typing your text. You will notice that the searched text will be highlighted to the nearest matching item. Once you select any item from the ComboBox, it will close by default. Now again try to type something (assuming the focus is still on the ComboBox control). You will see that, the item with maximum matched content has been selected in the control.


Similarly, if you do the same thing for the ListBox, you will find the same behavior in that too.


Hence, no need to write additional code to implement the feature in your Silverlight application anymore. Just add the ComboBox or ListBox depending upon your requirement and you are all set to go. Enjoy using the Text searching behavior.

Kunal Chowdhury
If you have come this far, it means that you liked what you are reading (Text Searching in Silverlight 5 ComboBox and ListBox).
Why not reach little more and connect with me directly on Twitter, Facebook, Google+ and LinkedIn. I would love to hear your thoughts and opinions on my articles directly.

Don't forget to share your feedback/queries in the comment section below.