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.

Have a question? Or, a comment? Let's Discuss it below...

Thank you for visiting our website!

We value your engagement and would love to hear your thoughts. Don't forget to leave a comment below to share your feedback, opinions, or questions.

We believe in fostering an interactive and inclusive community, and your comments play a crucial role in creating that environment.