Replies: 2 comments
-
This will have issues with Grouping, Sorting and Filtering. A better solution might be for you to create your own CollectionView class that implements IDataGridCollectionView. That way you can handle any special functionality like filtering if needed. If at all possible I urge you to implement IList if you can so that DataGridDataConnection class can use the faster IList path (specifically it needs Count, IndexOf and IList[index] implemented). Since the Avalonia Datagrid is based off of Silverlight I did a quick test by grabbing the code from here and modifying to work with Avalonia. Handled 12.5 million rows with no performance issues. Edit: added a copy of the CollectionView class I knocked together ... this is a very rough proof of concept and should not be used in production code. VirtualisingCollectionView.zip Instead of assigning your collection to the grids ItemsSource wrap it in the custom view first VirtualisingCollectionView f = new(yourData);
dg.ItemsSource = f; |
Beta Was this translation helpful? Give feedback.
-
I've attached a little project to show the custom collectionview in action, it handles millions of rows no problem but starts to struggle with billions ... this is a slowdown elsewhere in the grid control. it's pretty basic but you can compare the difference in loading speed between the default and the custom view, there's a few settings you can set to simulate loading paged data. ![]() It will log the output of the paging to the console window (you can really see the default view hammer it). |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I was wondering, why "real" virtualization wasn't addressed yet. I see no issues regarding this topic. With real virtualization I mean having a virtual list as an items source that might e.g. query the data from a database using paging. This way you can show millions of rows in the data grid but only the visible ones are instantiated and loaded from the database.
Right now CopySourceToInternalList() will iterate the whole source collection making virtualization impossible.
A minor change "fixes" this:
But this probably breaks stuff I have not tested yet and at least would need some care to cope with IRedonlyList's etc.
Beta Was this translation helpful? Give feedback.
All reactions