The Silverlight datagrid seems to load rows (firing off the LoadingRow event) while I scroll up and down.
Is there a wa开发者_运维百科y to prevent this behavior? I would like to load all rows at once when I set the datagrid's ItemSource.
Is this possible?
Most likely happening because SL datagrid uses virtualization for performance optimization. You can read more here, but it appears the solution is to add this to your DG declaration:
VirtualizingStackPanel.VirtualizationMode="Standard"
There is a good reason it does this. A datagrid in Silverlight automatically resizes itself. Only loading part of the data source does increase performance. Is is rather big deal if you have a lot of row, that is a lot of work for your GPU.
精彩评论