AutoCompleteBox需要很长时间才能对第一个

AutoCompleteBox需要很长时间才能对第一个

本文介绍了Silverlight AutoCompleteBox需要很长时间才能对第一个“搜索"响应做出响应.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Silverlight应用程序,该应用程序将大约六个字段的2000个对象加载到AutoCompleteBox中.然后将过滤器设置为在四个字段中的任何一个上进行搜索.我将其设置为开始搜索两个字符.

I have a Silverlight application which loads about 2000 objects of half a dozen fields into an AutoCompleteBox. The filter is then set to search on any of four of the fields. I've set it to begin searching after two characters.

但是,当我在填充对象列表之后第一次键入第二个字符(框应该开始填充)时,AutoCompleteBox大约需要6到7秒的时间来响应.

However, when I type the second character (when the box is supposed to start populating) for the very first time after populating the List of objects, the AutoCompleteBox takes about 6-7 seconds to respond.

关于如何优化这一点的任何想法?

Any ideas on how I can optimize this?

是否有一种方法可以在列表填充后立即创建这些视觉元素,而不是等待用户开始输入?

Is there a way to create these visual elements right after the list is populated instead of waiting for the user to begin typing?

推荐答案

您是否已经调整了MinimumPrefixLength属性?您需要的字符越多,过滤效果就会越好.

Have you alreay adjusted the MinimumPrefixLength propery? The more characters you require, the filtering will be better.

现在,使用低前缀,您可以创建2000多个视觉元素,而无需考虑其他任何优化方式,只需说一个过滤字符即可.

Right now, with a low prefix, you have 2000+ visual elements that are created, minus say one character of filtering, regardless of any other optimizations.

另一种选择是实现自己的后台线程过滤,但这会破坏控件的许多目的(即简单性).

Another option is to implement your own background thread-filtering, but that defeats many of the purposes for the control (i.e. simplicity).

这篇关于Silverlight AutoCompleteBox需要很长时间才能对第一个“搜索"响应做出响应.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 08:52