将AutocompleteMode设置为“建议"无效 [英] Setting AutocompleteMode to Suggest doesn't have an effect
问题描述
我的组合框很少.我通过绑定源(我使用EF6)初始化它们的数据源.我的组合框任务如下:
I have few comboboxes. I initialize their datasources through binding sources (I use EF6). My Combobox Tasks looks like this:
因此,当我将AutoCompleteMode属性设置为"Suggested"时,自动完成不起作用.奇怪的是,我还有另外两个组合框,它们的设置完全相同(我会说),并且它们起作用了……自动补全对它们起作用.
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.
如何调试它?
推荐答案
要设置自动完成用户输入字符串的ComboBox
,我们需要配置3个不同的属性.文档中的说明:
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:
使用
AutoCompleteCustomSource
,AutoCompleteMode
和AutoCompleteSource
属性以创建一个ComboBox
通过比较以下前缀自动自动完成输入字符串 输入维护的源中所有字符串的前缀
Use the
AutoCompleteCustomSource
,AutoCompleteMode
, andAutoCompleteSource
properties to create aComboBox
that automatically completes input strings by comparing the prefix being entered to the prefixes of all strings in a maintained source
AutoCompleteMode :定义如何执行输入自动完成.
AutoCompleteSource :指定哪个是完成功能的来源.
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.
使用已定义路径中的文件"或目录"列表,RecentUsedItems
,HistoryList
URL,或者在这种情况下为
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).
这篇关于将AutocompleteMode设置为“建议"无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!