简体   繁体   English

ComboBox行为

[英]ComboBox Behavior

When presenting a fixed list of countries in a ComboBox control, with no free text entry, the user expectation is that if they begin spelling out the name of the country, it will take them to that country name. 当在ComboBox控件中呈现固定的国家/地区列表时,没有自由文本输入,用户期望的是,如果他们开始拼写出该国家/地区的名称,则会将他们带到该国家/地区名称。 Instead, the default behavior is for it to move to the first item in the list that begins with that character. 相反,默认行为是它移动到列表中以该字符开头的第一个项目。 So, when they hit the second character of the name, it takes them to the first country beginning with that letter. 因此,当他们点击名字的第二个字符时,它会将他们带到以该字母开头的第一个国家。

For example, if I press "S" a bunch of times, it lets me scroll through all of the countries beginning with "S" to get to Singapore. 例如,如果我多次按“S”,它会让我滚动浏览所有以“S”开头的国家到达新加坡。 If I press "S", "I", "N", it takes me the first country starting with "S", then the first country starting with "I", then the first country starting with "N". 如果我按“S”,“I”,“N”,它将带我第一个以“S”开头的国家,然后是以“I”开头的第一个国家,然后是以“N”开头的第一个国家。 I'd rather have "S", "I", "N" take me to countries beginning with "Sin" 我宁愿让“S”,“我”,“N”把我带到以“罪”开头的国家

Is there an easy way to enable that latter behavior? 是否有一种简单的方法来实现后一种行为?

You can get this by setting the following properties on the combobox 您可以通过在组合框上设置以下属性来实现此目的

AutoCompleteMode = Suggest
AutoCompleteSource = ListItems
DropDownStyle = DropDownList

Now, they can't be slacking and typing real slow...but if they type at a reasonable speed it will jump down to what they need. 现在,他们不能懈怠和键入真正的慢......但如果他们以合理的速度输入,它将跳到他们需要的东西。

If they are slow, it will behave like you mentioned 如果它们很慢,它的行为就像你提到的那样

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM