开发者

AutoCompleteBox max number of results

开发者 https://www.devze.com 2023-02-02 01:12 出处:网络
I\'m using wpf toolkit AutoCompleteBox control and I want it to display only 5 results, How can I set this ?

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 result开发者_C百科s are displayed but with scrollbar.


Set your ItemFilter to a delegate of type...

public AutoCompleteFilterPredicate<Object> ItemFilter { get; set; }

...doing this will also default the FilterMode to Custom. 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号