I'm working with the WPF DataGrid and .Net 4.5 and I'm trying to roll my own data virtualization container for a large collection. I've been all over the web and found many helpful examples of how to implement data virtualization, but in every example I've seen, the savings are lost if you do any grouping. My grouping is simple and static. Is there a way to fake grouping in WPF in such a way that my collection doesn't have to enumerate all items ahead of time? For example, has anyone ever overridden the ListCollectionView
's GetItemAt()
and just returned a CollectionViewGroup
object at the start of each group?
Concrete Example:
- Say for example I have a database with 100K records. I want to create a data virtualization collection similar to Bea Stollnitz' example and use it in a WPF DataGrid.
- I want to group items in the DataGrid on a field, but I can do that by modifying my database query to first return all items in group A, then all items of group B. Grouping is done before the DataTable even sees it.
- How do I visually represent the grouping inside the WPF DataGrid even though my collection (from the DataGrid's perspective) is flat? The only way I've found to show grouping in a DataGrid is by using a CollectionView or similar.
.