DataGrid vs GridView

Nov 25, 2008 at 11:14 PM
Edited Nov 25, 2008 at 11:15 PM

I was wondering what one gets with the new DataGrid instead of using the ListView's GridView.  I would like to use the DataGrid but a collegue of mine can't see any benefits to using it over the ListView GridView that is already in WPF.  Unfortunately I don't know why he would want to use the DataGrid instead.

Nov 26, 2008 at 9:44 AM
Much better support for editing data would be one reason that may or may not be relevant depending on your use cases.
Nov 26, 2008 at 11:48 AM
Here's a few
  • ListView (GridView) is a readonly control out-of-the-box.The standard solution would be to synchronise the list with a 'details view' comprised of textBoxes.
  • The DataGrid allows in-place editing of data.
  • The DataGrid performs transactional edits (the row is treated as an atom).
  • The DataGrid support auto-column generation.
  • The DataGrid has a RowDetails element (if you like that sort of thing!)
  • The DatGrid supports pretty much everything the ListView does, multiple selection modes, styling, etc ...
In my mind the bottom line is - do you want in-place editing? if not, the two are reasonably close.

Colin E.
Nov 26, 2008 at 4:36 PM
I do not need in-line editing, but I need styling (incl based on data), flexible sorting, flexible selection, and nested elements (another DataGrid). So my choice is still DataGrid