Silverlight: paging data from the server

I have a server-side API that provides paged data in JSON format based on various request parameters. I would like to provide a user interface that allows the user to forward query results.

I am aware of various components that allow you to use this kind of interface, IPagedCollectionView and ICollectionView on the model / view lever of the model and DataPager in the user interface. However, all the examples I've seen do a swap on top of the data that is already loaded into the model or view model.

I was hoping to find an implementation of IPagedCollectionView somewhere where you simply plug in your "fetcher" method, which fetches the given page of data from the server, plus provides some metadata (shared pages, etc.)

I could write it myself based on the IPagedCollectionView and ICollectionView interfaces, but I would be surprised if there is no standard solution to this problem.

Any pointers to more suitable parts of the structure or libraries that extend the structure will be appreciated!

+7
source share
2 answers

We had the same question, and we agreed with the new DomainCollectionView, which is part of WCF RIA Services SP1. Which of the codes means that you should use the RIA services, do not know if this option is.

DomainCollectionView (which already implements the desired IPagedCollectionView interface) comes with a DomainCollectionViewLoader that can be used to retrieve data for the current page.

For me, this Kyle McCellan blog post was very helpful:

http://blogs.msdn.com/b/kylemc/archive/2010/12/02/introducing-an-mvvm-friendly-domaindatasource-the-domaincollectionview.aspx

[Update] You may also find this blog post helpful:

http://weblogs.asp.net/manishdalal/archive/2009/10/01/silverlight-3-custom-sorting-with-paging-support.aspx

This is a custom implementation of the IPagedCollectionView interface. We use it in one place, where we combine data from different data sources, and DomainCollectionView is not applicable.

+3
source

You can try WCF data services, which may possibly feed json. it has api for "extensions" that handle requests efficiently. You may find it a little strange to use this as a wrapper, but I'm sure you can make it work.

http://blogs.msdn.com/b/writingdata_services/archive/2011/02/25/getting-json-out-of-wcf-data-services.aspx

+1
source

All Articles