Subscribe method in IDataListSource

Nov 8, 2012 at 3:57 AM

What's supposed to go in the IDataListSource.Subscribe method?

I'm getting a WinRT internal exception when quickly scrolling (with mouse wheel) a ListView backed by a VirtualizingDataList, and I am wondering if that could be the cause. Any suggestions for debugging this would also be helpful.

Otherwise I'm pretty excited to have a couple hundred images being dynamically loaded and scrollable in a list. Thanks for this project!

Paul

Coordinator
Nov 8, 2012 at 12:44 PM

Hi Paul,

The IDataListSource.Subscribe(...) method is designed to allow a data list source to publish changes to any subscribing collections (i.e. items added/removed/list reset). In many cases the list of items doesn't change (or at least not within a particular instance of an application) so no notifications are required, however you should always return an IDisposable instance, even if the methods are all blank. This IDisposable is disposed when any subscriber wishes to stop receiving change notifications (a bit like the Reactive Framework if you are familiar with this).

The good news however is that the Okra framework's SimpleDataListSource and PagedDataListSource classes provide basic implementations of IDataListSource.Subscribe(...) so if you are deriving from these then this should be done for you. Is this the case of are you writing your own IDataListSource implementation? (NB: If you are then the DataListSourceBase provides simple change subscriptions).

Let me know how you get on with this and I'll try to help diagnose you exception issues.

Regards,

    Andy