Sandeep
Sandeep

Reputation: 420

WPF Listview SORT and FILTER performance issue

I have listview with custom sort and filter implemented on it...It is textbox based filter , as user types in, items in the listview are filtered. Now...when i apply sort on listview, filter is very slow because each time custom sort compare method is called for each item in listview while filtering... how I can avoid compare method call of custom sort while filtering ?

Upvotes: 2

Views: 2571

Answers (2)

Hoddmimes
Hoddmimes

Reputation: 181

List performance issues can also be caused by a non-virtualized list:

for a virtualized list only the visible elements are calculated for the display, whereas for a non-virtualized list, the display is calculated for all the items. This can be disastrous for lists of a few hundred items.

WPF: List boxes and virtualization

Upvotes: 1

Nir
Nir

Reputation: 29594

You can sort the list before setting it into the ListView, it may be less convenient but I think that's the only way to avoid resorting when you change filter

Upvotes: 0

Related Questions