I got really big ObservableCollection<MyItem>
and I need to provide user-friendly filtering on it.
public static async Task RefilterViewAsync(this ItemsControl @this, Predicate<object> compareLogic)
{
await Task.Run(
() =>
{
var collectionView = CollectionViewSource.GetDefaultView(@this.ItemsSource);
if (collectionView.CanFilter)
{
collectionView.Filter = compareLogic;
}
else throw new InvalidOperationException("Filtering not supported...");
collectionView.Refresh();
});
}
..the problem is that the code above doesnt work for some reasons. Fitering on UI-thread takes around 1 minute. Any ideas how to implement async filtering, at least to be able display some "processing.." animation to help user overcome that?