Silverlight 5–Combo box type ahead

A nice, small feature in the new Silverlight 5 Beta is the ability toCombobox type ahead in combo boxes.

This makes choosing from long list far simpler.

You can see this at work by whipping up a very quick Silverlight 5 application.

On the Main page add a combo box,


      Margin="20" />

In the code behind we’ll create some data to act as the ItemsDataSource for the combo box:

public MainPage( )
   InitializeComponent( );
   List<string> contents = new List<string>
   { "apples",
      "apple pie",
      "apple strudel",
      "cherry pie",
   theComboBox.ItemsSource = contents;

That’s enough to see the effect.  When you run the program the combo box comes up empty. Start typing apple strudel and you’ll see that the combo box first finds apples, then apple pie (on the space) and then when you type the s, it finds apple strudel. 

You can see this most clearly by rerunning the application and opening the combo box before you begin typing. You can then see the selected item move as you type (see image at top).  Nice.

About Jesse Liberty

Jesse Liberty has three decades of experience writing and delivering software projects and is the author of 2 dozen books and a couple dozen Pluralsight & LinkedIn Learning courses. He was a Senior Technical Evangelist for Microsoft, a Distinguished Software Engineer for AT&T, a VP for Information Services for Citibank and a Software Architect for PBS. He is a Xamarin Certified Mobile Developer and a Xamarin MVP and a Microsoft MVP.
This entry was posted in Data, Essentials, Silverlight 5 and tagged . Bookmark the permalink.

9 Responses to Silverlight 5–Combo box type ahead

Comments are closed.