I know grid performance has been discussed many times, but I could not derive a solution so far from those posts.
The scenario is very simple, we have to show 20 items in a grid. The data paging responsibility is ours, the grid sees only 20 rows.
When the ItemsSource changes, 1-2 sec is needed for the grid to display the new results.
The performance is bad regardless of Virtualization settings (and 20 rows do not need virtualization at all naturally).
Fixed Height and With do not help, I think this is not the usual infinite height MeasureOverride issue.
I have attached DotTrace and VS profiler traces, so you can see the problematic paths.
The profiler pinpoints MeasureOverride at the surface. Most posts about grid performance revolve around this.
However, when we dig deeper we see creating each datagrid row took about 50ms.
For 20 rows this is 1sec. This explains the perceived delay.
The attached dottrace images show that LoadContent is called many hundred times, this is what actually eats the time.
Now, it is your turn to explain what I can do to avoid this big performance overhead.
Tell me if you need more profiling data from me.
Thanks,
Zsolt