I need an autocomplete combobox for WPF C#. I\'ve tried several approaches but nothing works. For example I\'ve tried a combobox:
Use ComboBox.Items.Filter to show items that fits the text written in the textbox. This is an example:
If cmb.Text = "" Then
cmb.Items.Filter = Nothing
Else
Dim T = cmb.Text
cmb.Items.Filter = Nothing
Dim I = cmb.Items.IndexOf(T)
cmb.Items.Filter = Function(x As String)
If x.StartsWith(T) Then Return True
If x.Contains(" " & T) Then Return True
Return False
End Function
If I = -1 Then
cmb.SelectedIndex = -1
cmb.Text = T
Dim txt As TextBox = cmb.Template.FindName("PART_EditableTextBox", cmb)
txt.SelectionStart = T.Length
Else
cmb.SelectedIndex = 0
End If
End If