AutoCompleteBox Control in Silverlight using C#


In this article we take a TextBox for user input. ComboBox that would allow them to scroll the entire list, as well as filter the list as the user typed in the TextBox. you see your word is being typed automatically based on the character you type. This control that provides this functionality is called an AutoCompleteBox.

AXML code:

<UserControl x:Class="SilverlightApplication14.MainPage"






    d:DesignHeight="300" d:DesignWidth="400" xmlns:sdk="" Loaded="UserControl_Loaded">


    <Canvas Background="AntiqueWhite"


            Width="250" >

        <TextBlock Canvas.Left="5"


                   Text="Autocompltete Control"







        <TextBlock x:Name="txtName"



                   Text="Enter the Name:"






        <sdk:AutoCompleteBox x:Name="autoComplete"




                             Canvas.Left="136" SelectionChanged="autoComplete_SelectionChanged" />



Now double click on the form and add the following code.

C# code

public MainPage()



            List<string> nameList = new List<string>


                "Rohatash", "Ravi", "Rahul","Rajesh", "Ram", "Raj kumar",

                       "raj", "Catherina Biel", "Christopher Ben",

                       "Dan Gupta", "Diptimaya Patra", "Dhananjay Kumar",

                       "Elizabeth Hurley", "Elisa Cuthbert", "Emma Bunton"


            autoComplete.ItemsSource = nameList;



The below figure defines the AutoCompleteBox when we enter character in the TextBox related search character or string will be display.



Ebook Download
View all
View all