Question

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.

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top