自动完成框最大结果数
我正在使用 wpf 工具包 AutoCompleteBox 控件,我希望它只显示 5 个结果,我该如何设置?
我注意到有一个名为“MaxDropDownHeight”的属性,但它没有帮助,因为显示了超过 5 个结果,但带有滚动条。
I'm using wpf toolkit AutoCompleteBox control and I want it to display only 5 results, How can I set this ?
I've noticed that there's a Property called "MaxDropDownHeight" but it doesn't help since more than 5 results are displayed but with scrollbar.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将您的
ItemFilter
设置为类型的委托......这样做也会将
FilterMode
默认为Custom
。示例位于 MSDN 站点。一旦实现了基本功能,您将需要保留类级别计数,以便可以返回 N 个值,因为过滤器将为每个项目调用一次。
因此,将你的班级等级数设置为 5;一旦你点击 6,你可能会在你的过滤器代码中返回 false。
此外,您需要知道搜索条件何时发生更改,以便您可以从 0 开始过滤过程。
Set your
ItemFilter
to a delegate of type......doing this will also default the
FilterMode
toCustom
. An example is located on the MSDN site.Once you have the base functionality implemented you will need to keep a class level count so that you can return N values since the filter will be called once for each item.
Thus by setting your class level count to 5; once you hit the 6 you could return false within your filter code.
In addition you will need to know when the search criteria has changed so you can begin the filtering process from 0.