Saturday, April 27, 2013

AutoComplete Text Box in Windows Phone

Today, we are going to see how to use Auto complete text box in Windows Phone. For this we have to first download the Silverlight toolkit.

We can download toolkit from codeplex
Once you have downloaded toolkit from above location, go ahead and install it.

So, let's start and see how we can use Auto Complete text box in our application

1) Open up the Windows Phone application and name it as 'WPAutocompleteTextBox'








2) Select Target Phone OS version as 'Windows Phone OS 7.1'





3) If you hover your mouse to Toolbox, you will find new toolkit controls added to it.




4) Now add the Auto Complete text box to your page and give the desired height and width





5) Update the Application Title to "Windows Phone Examples" and Page Title to "AutoComplete TextBox"

6) Move to code behind page, where we would be setting the Item Source of the Auto Complete textbox. Item source means from where data would be extracted.


 public MainPage()
        {
            InitializeComponent();
            txtPhone.ItemsSource = new string[]
            {
                "ASP.NET",
                "ASP.NET3.5",
                "VB.NET",
                "SQL",
                "Oracle",
                "ASP.NET 4.5",
                "LINQ",
                "MVC"
            };
        }

7) Once done, run the application and type keyword as "A" and you will find all the text starting with "A" such as "ASP.NET", "ASP.NET 3.5","ASP.NET 4.5".





Hope with this article of mine, you have become familiar with Auto complete textbox and how to use same in Windows Phone

No comments:

Post a Comment