Windows Phone 8.1 中 AutoSuggestBox 的奇怪结果 [英] Strange results in AutoSuggestBox in Windows Phone 8.1

查看:18
本文介绍了Windows Phone 8.1 中 AutoSuggestBox 的奇怪结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在 Windows Phone 8.1 XAML 应用程序中使用标准的 AutoSuggestBox,但它的行为非常奇怪.

I am trying to use the standard AutoSuggestBox in a Windows Phone 8.1 XAML app, but it behaves really strangely.

在一个简单的演示中,我有收藏

In a simple demo, I have collection

Items = new ObservableCollection<string>
        {
            "a",
            "b",
            "c",
            "d"
        };

以及 XAML 中的 AutoSuggestBox:

and he AutoSuggestBox in XAML:

<AutoSuggestBox ItemsSource="{Binding Items}" />

问题是,无论我向 AutoSuggestBox 写什么,我总是得到所有项目:

The problem is that no matter what I write to the AutoSuggestBox, I always get all the items:

文档几乎没有说明,我还没有找到任何使用此控件的示例.

The documentation says next to nothing and I have not found any samples using this control.

推荐答案

基于 这篇博文,看起来您所期望的(自动过滤)并非如此 - 相反,您需要连接到 TextChanged事件并自己填充 Suggestions 集合.

Based on this blog post, it looks like what you're expecting (automatic filtering) isn't the case - instead, you need to hook into the TextChanged event and populate the Suggestions collection yourself.

来自 文档:

当用户更改文本时,应用会收到通知,并负责提供相关建议以显示此控件.

The app is notified when text has been changed by the user and is responsible for providing relevant suggestions for this control to display.

这篇关于Windows Phone 8.1 中 AutoSuggestBox 的奇怪结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆