0

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?

Community
  • 1
  • 1
vigamage
  • 1,975
  • 7
  • 48
  • 74

1 Answers1

1

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.

CBreeze
  • 2,925
  • 4
  • 38
  • 93
  • Then irrespective of forms or WPF, I will be able to use this. right? – vigamage Feb 08 '16 at 08:50
  • @vigamage the ones I linked you will only work in `WPF`. in `WinForms` You can just use the in-built `TextBox` which has `AutoComplete` already built into it. – CBreeze Feb 08 '16 at 09:12
  • I am going to use the NuGet one. I installed it and now trying to code the control for that. (to load data from db to datacontext). since I am new to C#(I am from Java background) I find it difficult to bind the text box and the data I have in the DB. Any examples for this online? – vigamage Feb 08 '16 at 09:17
  • [Tutorial](https://github.com/Nimgoble/WPFTextBoxAutoComplete) - try this @vigamage – CBreeze Feb 08 '16 at 11:01