Jesse
Jesse

Reputation: 599

Silverlight datagrid load all rows

The Silverlight datagrid seems to load rows (firing off the LoadingRow event) while I scroll up and down.

Is there a way to prevent this behavior? I would like to load all rows at once when I set the datagrid's ItemSource.

Is this possible?

Upvotes: 1

Views: 1502

Answers (2)

Joe Tyman
Joe Tyman

Reputation: 1417

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.

Upvotes: 0

Scott Silvi
Scott Silvi

Reputation: 3109

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"  

Upvotes: 2

Related Questions