FREE Subscription to Dr. Dobb’s Digest: Same Great Content, New Digital Edition
Site Archive (Complete)
Dobbs M-Dev
Email
Print
Reprint

add to:
Del.icio.us
Digg
Google
Furl
Slashdot
Y! MyWeb
Blink
November 11, 2008

The Silverlight Toolkit

(Page 3 of 6)

AutoCompleteBox Control

The AutoCompleteBox controls acts much like the AutoCompleteExtender control found in the ASP.NET AJAX Control Toolkit. It allows data to be displayed under a TextBox as users type characters. The XAML code that follows defines an AutoCompleteBox control named acCountries that displays data after a user types a single character:

<controls:AutoCompleteBox x:Name="acCountries" 
   MinimumPopulateDelay="200"
   MinimumPrefixLength="1"
   Width="260"
   HorizontalAlignment="Left" />

You can bind auto complete data to the control using the ItemsSource property:

private void BindData() { acCountries.ItemsSource = new List<string>() { "USA", "Spain", "Mexico", "Canada", "Costa Rica" }; }

Here's what the end user would see as they type "c" into the text box:

The AutoCompleteBox supports filtering auto complete data using Lambdas, exposes a rich set of properties and events and allows templates to be defined. Here's an example of applying a custom template to the control's ItemTemplate property to display pictures and text as the user types:

Previous Page | 1 Introduction | 2 Managing Silverlight Styles with ImplicitStyleManager | 3 AutoCompleteBox Control | 4 WrapPanel Control | 5 TreeView Control | 6 Chart Control Next Page
TOP 5 ARTICLES
No Top Articles.



MICROSITES
FEATURED TOPIC

ADDITIONAL TOPICS

INFO-LINK