.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Articles >> WPF >> Post New Resource Bookmark and Share   

 Subscribe to Articles

AutoComplete Textbox in WPF

Posted By:Diptimaya Patra       Posted Date: March 13, 2010    Points: 25    Category: WPF    URL: http://www.dotnetspark.com  

AutoComplete Textbox in WPF. This article is a simple approach for achieving AutoComplete for TextBox.
 

Introduction

I have gone through a lot of AutoComplete TextBox in WPF articles. This article is a simple approach for achieving AutoComplete for TextBox.

Crating WPF Application Project

Fire up Visual Studio 2008 and Create a WPF Application and name the project as AutoCompleteWPF.

image1.gif

Here is the basic things we need to do for achieving AutoComplete feature for a TextBox.

First we need to have a TextBox and a ListBox. You can see the below screenshot and xaml for reference.

image2.gif

image3.gif

Now we would write code to achieve this.

Create a sample data, in our case it is List of Strings.

image4.gif

Now in TextChanged event we need to write the below code:

image5.gif

As we would see the suggestion would pop up and we can select on the particular item write the below code for SelectionChanged event of ListBox.

image6.gif
That's it. Run the application.

image7.gif

You can design the suggestion style as per your requirement.

Hope this article helps.
 Subscribe to Articles

     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More Articles on C#, ASP.Net, Vb.Net, SQL Server and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend