Chrisjan Lodewyks
Chrisjan Lodewyks

Reputation: 1182

WPF ListView vs DataGrid Performance

I am currently only using ListViews in WPF to display data that does not need to be edited. But I don't really like the style of the ListView and it seems to be missing some functionality like letting a GridViewColumn fill the remaining space. So I was wondering what the performance impact would be if I start using non-editable DataGrids.

Is there a large performance difference if any between the two?

Upvotes: 3

Views: 7038

Answers (1)

Vimal CK
Vimal CK

Reputation: 3563

ListView in WPF is a light-weight control : some functions provided by DataGridView are not available. See this Stackoverflow answer for further information. If you are not satisfied with the ListView functions then DataGridView is the other choice to solve your problems.

Keep in mind that a DataGridView control will take some additional memory space on loading. However, the memory difference occupied by the ListView and DataGridView controls should not be large. This memory size can be seen by some memory profiling tools like the .Net memory profiler.

Some third party controls have memory leak issues which will hinder overall application performance, but all the controls in Microsoft libraries are performance and memory optimized.

With small amounts of data (<100 rows), you can't feel any performance difference between these controls. But if your application tries to display some big amount of data (>1000 rows) it may cause a delay of operations like scrolling: that's why the feature called VirtualizationStackPanel was implemented. Using it may resolve scrolling issues.

Upvotes: 3

Related Questions