vigamage February 2016

WPF Auto Complete Text box property

I am very new to C# and WPF. I have been developing and application in which I need to use an auto complete text box. For that, I follow the article in this link. http://net-informations.com/q/faq/autocomplete.html

But when I code, Visual Studio gives me the error saying,

'System.Windows.Controls.TextBox' does not contain a definition for 'AutoCompleteSource' and no extension method 'AutoCompleteSource'....

As I think the reason might be, WPF does not contain the definition for Auto Complete textbox. Therefore As I found in a comment for the second answer in this question, I added the WPF toolkit and added the reference to my project(as described here).

But still I don't see the autocomplete text box getting appeared in my tool box and that above mentioned error getting disappeared.

Why is this and how Can I get autocomplete text box into my tool box?

Answers


CBreeze February 2016

WPF doesn't have an in-built AutoComplete TextBox. You need to use third-party software, try something like this;

WPF TextBox AutoComplete 1.0.2

or

WPF AutoComplete

The article you were following uses WinForms, which WPF is the new version of.


91378246 February 2016

The default TextBox in WPF doesn't contain an autocomplete property. You have to use a extern library to archive this. I programmed such a library (which also contains a lot of other controls). You can download it here (the leftmost icon).

Just drag and drop the .dll file into your Toolbox, wait a few sec and then you should see some new controls. Drag the 91378246_TextBox into the designer. In the properties, under 'Miscellaneous' (Last category in the Properties window) you can set the properties for auto complete. Additionally you can do this via c# code. Every custom property start with an underline.

Post Status

Asked in February 2016
Viewed 2,568 times
Voted 6
Answered 2 times

Search




Leave an answer