Shahbaz Shahbaz - 4 years ago 142
C# Question

How I can make an Autocomplete TextField in WPF?

How I can make an Autocomplete Text Field in WPF?
How I can include multiple value in text field.
Actually I'm trying to make an search bar in which Products are fetched from database and include in text field then.When i type a keyword it should be display an suggestion.

Answer Source
  1. Re-template ComboBox to make it looks like TextBox.
  2. Extend ComboBoxItem so that we can hightlight the already entered part in the dropdown list.
  3. Get reference to the TextBox part of the ComboBox, and hook up TextBox.TextChanged event.
  4. In the TextBox.TextChanged event handler, we filter the underlying datasource and create new list source with our customized ComboBox Items.

Hope this will be helpful.

Thank you

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download