简体   繁体   English

实现增量搜索以筛选GridView结果?

[英]Implementing incremental search to filter GridView results?

I'm writing a Windows 8 Metro app with a GridView with several pages worth of items. 我正在用GridView编写Windows 8 Metro应用程序,其中包含几页项目。 I'd like to provide the user with an incremental-search kind of filtering capability. 我想为用户提供一种渐进式搜索过滤功能。 I'm thinking it would pop up a text field as soon as the user starts typing. 我在想,一旦用户开始输入,它将弹出一个文本字段。

I thought that implementing the search contract might be the way to accomplish this, but it doesn't appear to have the incremental behavior I'm looking for. 我认为实现搜索合同可能是实现此目的的方法,但是它似乎没有我想要的增量行为。

Anyone know of an example of something like this? 有人知道这样的例子吗?

Thanks. 谢谢。

You can wire into the SuggestionsRequested event from the SearchPane.getForCurrentView(). 您可以从SearchPane.getForCurrentView()连接到uggestinationsRequested事件。 As the user types, you could process each key stroke and filter the data you are displaying in the Grid. 随着用户的键入,您可以处理每个按键并过滤显示在网格中的数据。

Having said that, filtering is usually implemented directly in the UI and not via the Search contract. 话虽如此,过滤通常是直接在UI中实现的,而不是通过Search合同实现的。 Thus, I like your idea of going with a text field and processing each keystroke. 因此,我喜欢您使用文本字段并处理每个击键的想法。

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

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