Nimgoble / WPFTextBoxAutoComplete

An attached behavior for WPF's TextBox control that provides auto-completion suggestions from a given collection
https://www.nuget.org/packages/WPFTextBoxAutoComplete/
MIT License
100 stars 37 forks source link

How to bind strings? #9

Closed ghostiq closed 7 years ago

ghostiq commented 7 years ago

I have created an extra field to a window: public IEnumerable<string> TestItems = new List<string>();

And then in a constructor I inserted:

DataContext = this;
TestItems = new List<string>() { "john", "Mark", "Doe" };

but it doesn't load any suggestions. What else do I need?

Quade369 commented 7 years ago

autocomplete:AutoCompleteBehavior.AutoCompleteItemsSource="{Binding TestItems}"

Did you add this to the XAML for the edit?

This is how you connect the autocomplete to your actual text control. Yours might not use the "autocomplete:" that's simply how I referenced the control in my XAML file.

Nimgoble commented 7 years ago

What @Quade369 said.