Silverlight 自动完成框

发布于 2024-10-13 08:52:34 字数 211 浏览 4 评论 0原文

有谁知道如何下拉 AutoCompleteBox 以查看所有值,而无需猜测条目并开始输入。

我知道我可以使用组合框,但在用户需要输入大量信息的数据输入表单上,用户最好尽可能少地拿起鼠标,因此我想使用自动完成框。然而,在较小的列表中,快速提醒您可以与向上/向下箭头组合进行的选择也很有用。

我看过一些将两个控件的功能合并为一个的示例,我可能会这样做,但想知道是否有更简单的方法。

Does anyone know how to drop down the AutoCompleteBox to see all the values without guessing at an entry and starting typing.

I know I could use a ComboBox but on a data entry form where a user needs to enter lots of information it is preferable for the user to pick up the mouse as little as possible and so therefore I wanted to use the AutoCompleteBox. However, in smaller lists it is also useful to quickly be reminded of the choices which you could do in a combo with the up/down arrow.

I have seen some examples of combining the two controls' functionality into one and I may go this way but wondered if there is a simpler way.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

爱的那么颓废 2024-10-20 08:52:34

当我这样做时,我在组合框顶部有一个自动完成框,它们都绑定到相同的值,并且自动完成框具有更大的右边距,因此您可以看到组合框箭头。然后,我创建了一个打开结果列表的获得焦点事件,并将 MaximumPrefixLength 设置为 0,这样它就可以在不输入任何内容的情况下进行搜索。

XAML

<sdk:AutoCompleteBox IsTextCompletionEnabled="True" MinimumPrefixLength="0" GotFocus="AutoComplete_GotFocus" />

代码隐藏

private void AutoComplete_GotFocus(object sender, RoutedEventArgs e)
{
     AutoCompleteBox box = (AutoCompleteBox)sender;
     box.IsDropDownOpen = true;           
}

When I did this I had an autocomplete box on top of a combobox that were both bound to the same value, with the autocomplete box having a larger right margin so you could see the combobox arrow. Then I created a got focus event that opens the list of results and I set the MinimumPrefixLength to 0 so it would search with nothing typed in.

XAML

<sdk:AutoCompleteBox IsTextCompletionEnabled="True" MinimumPrefixLength="0" GotFocus="AutoComplete_GotFocus" />

Code Behind

private void AutoComplete_GotFocus(object sender, RoutedEventArgs e)
{
     AutoCompleteBox box = (AutoCompleteBox)sender;
     box.IsDropDownOpen = true;           
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文