0

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.

Soner Gönül
  • 97,193
  • 102
  • 206
  • 364
Winter Winter
  • 173
  • 2
  • 11

1 Answers1

0

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.

Wilka
  • 28,701
  • 14
  • 75
  • 97
  • Thanks for the comment... and harsh news. So do u have any suggestions around filtering a dataset? I can only think of keeping a base dataset, and binding on a view purpose dataset, and clearing and adding entities each time it needs filtering. And in that case, I should be able to use RX to put the action in background thread. – Winter Winter May 22 '13 at 12:48