开发者

Listview vs datagrid

What are the main advantages of using a开发者_如何转开发 datagrid control over using a listview? When should each one be used?


Some points to consider that Colin Eber have stated in DataGrid vs GridView discussion:

  • 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 transaction 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 ...

And another important one:

  • The DataGrid has build-in sorting support by clicking on column header. While add sorting to ListView/GridView is absolutely possible, I'd rather prefer to have such kind of things out-of-the-box in DataGrid.


I've abandoned the ListView for the DataGrid in .Net 4, since templating the columns is easier.

Layout is also more sensible, and I don't need to remember to set the HorizontalContentAlignment to Stretch to get the cell contents to cover the cell. Another nice bit of functionality is edit templates on the DataGrid, which relieves me of having to use a CellTemplateSelector to get a different control when editing the cell.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜