Difference between ListView and DataGrid in WPF?

MangoTable picture MangoTable · Jan 22, 2011 · Viewed 49.3k times · Source

I have to retrieve some questions from the database and display them on the user screen dynamically. I also need to add some controls in the columns of grid view, basically a question and input box for an answer.

Please suggest which one should I use? ListView or DataGrid?

Answer

Yogesh picture Yogesh · Jan 22, 2011

Well, in WPF the difference between ListView and DataGrid is just one. Editing. You need editing use DataGrid, otherwise use ListView. You can edit in ListView also but it is easier and build in DataGrid. Otherwise, whatever can be displayed in DataGrid, can be displayed in ListView.

One thing which DataGrid supports and ListView doesn't (out of the box) is automatic column generation.

You can read this article on CodeProject for a better understanding of DataGrid and also about the major differences between ListView and DataGrid.