Setting AutocompleteMode to Suggest doesn't have an effect

不打扰是莪最后的温柔 提交于 2019-12-08 06:17:30

问题


I have few comboboxes. I initialize their datasources through binding sources (I use EF6). My Combobox Tasks looks like this:

So, when I set AutoCompleteMode property to Suggested, the auto complete doesn't work. The weird thing, is that I have two another comboboxes, with (I would say) the exact same setup, and they work...The autocompletion works on them.

How to debug this?


回答1:


To set up a ComboBox that automatically completes the user's input string, we need to configure 3 different properties. A description from the Docs:

Use the AutoCompleteCustomSource, AutoCompleteMode, and AutoCompleteSource properties to create a ComboBox that automatically completes input strings by comparing the prefix being entered to the prefixes of all strings in a maintained source

AutoCompleteCustomSource: the specialized collection of items that provides the source of the Autocomplete strings.
AutoCompleteMode: defines how the input auto-completion is performed.
AutoCompleteSource: specifies which is the source of the completion functionality.

The latter could be the FileSystem, using the Files or Directories lists in a defined path, the RecentUsedItems, HistoryList URLs or, as in this case, AutoCompleteSource.CustomSource, indicating that the source list of items for the completion is provided by an AutoCompleteStringCollection which can be specified assigning the AutoCompleteCustomSource property a AutoCompleteStringCollection or another compatible source (a List for example, since this collection implements the IEnumerable and IList interfaces).



来源:https://stackoverflow.com/questions/53248898/setting-autocompletemode-to-suggest-doesnt-have-an-effect

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!