still trying to get my DataGrid go faster, I have a question about this:
myDataGrid.SetValue(VirtualizingStackPanel.IsVirtualizingProperty, true);
I have read on multiple occasions that this could improve the dataGrid’s loading time.
Right…
- tried it, did not see any difference at all
- tried every possible combination with row / column virtualization, did not see any difference either
- tried to set this about everywhere I thought it could make a difference in the DG’s template (on the DG itself, then on the scrollviewer and a couple other places I’d rather not tell since they were really long shots and I’m ashamed to admit I actually even tried them), but with no success.
so my questions:
- What is this line of code supposed to do?
- how does it work?
- where should I put it to really see a difference?
- and has anybody actually ever tried this and was there really a substantial improvement in the DG’s loading time? or are all the suggestions about writing this just that: suggestions?
According to the answer to this question virtualization is turned on by default, so it’s no surprise that there is no difference if you add that line.
Virtualization means that the controls needed for data display are generated only if the data is visible, that means invisible rows use no additional memory for their controls if they are not visible, after all there is no need to generate thousands of controls if only 20 are visible at a time.