Question

I have a fairly large amount of data, and binding ListViews, DataGrids with CollectionView, and using OnFilter event to filter the CollectionView.

So when loading data for CollectionView and also when string property FilterString changes, it calls CollectionView.Refresh() on Setter, the actions locks up the screen too long, so I tried using a different thread to load data and filtering data, but as CollectionView does not support different thread, program crashes.

Can someone give me some guideline how to make RX work for this purpose?

Training video or article with sample code will be greatly appreciated.

Thanks a lot.

Était-ce utile?

La solution

The short answer is that you can't. You need to be on the UI thread to call CollectionView.Refresh(). Rx doesn't change that.

However, instead of doing your filtering with a CollectionView, you might be able to use a ReactiveCollection from ReactiveUI. This will take a bit more work, but if you're keen on using Rx then this is probably the best way to go about it.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top