Project Description


PagedCollection helps a developer to easily control the pagination of their collection.
This collection doesnt need all datas in memory, it can be attached to RIA/SQL/XML data ... and load needed data one after the other.

The PagedCollection can be used with Silverlight.

This project just implement 4 classes :

  • ExtendedCollection.cs :
    • Collection that implements ICollectionView, inheriting from ObservableCollection.
    • Enables collections to have the functionnalities of current record management, custom sorting, filtering and grouping.
  • PagedCollection.cs :
    • Collection that implements IPagedCollectionView, inheriting from ExtendedCollection.
    • Implement methods and properties that a collection need to provide pagination functionnalities.
  • PagedCollectionFilter.cs :
    • Used to add filters in PagedCollection ( with FilterType enumeration ).
    • Added to the collection, only to store the filter used in the query.
  • CollectionExtensions.cs :
    • Just some extensions ( it's free xD ).
All the pages are loaded dynamicly, on each pagination ! There is not 5000 entities loaded in memory, but just 20 per 20, 50 per 50, 178 per 178 .... as you want , in a RIA Service, LINQtoSQL, XMLDocument etc...

Included in downloads parts you can find a MVVM Test application using the PagedCollection :

  • Attached to an RIA Service
  • Search needed data in RIA after each filters, sorts, choise of page
  • The PagedCollection is created in ViewModel
  • The PagedCollection is binded to the page size choice, to a DataGrid and to a pager control
easy2.png

Initialization (HomeViewModel)
  1. DomainContext creation
  2. PagedCollection creation
  3. PageSize setting
  4. SortDescription creation ( mandatory in RIA to do Skip/Take )
  5. Event attachement, notified when the PagedCollection needs new datas
  6. RIA LoadBehavior
Initialize.png

RequireUpdate Event (RIA exemple)
  1. Query creation
  2. Filter settings
  3. Sort settings
  4. Skip/Take settings
  5. Query loading
query.png

Last edited Nov 12, 2011 at 3:05 PM by SpaaJ, version 35