列表视图VS数据网格网格、视图、数据、列表

2023-09-03 12:48:18 作者:心之所向

什么是使用DataGrid控件在使用ListView的主要优势是什么?什么时候应该每个人使用?

What are the main advantages of using a datagrid control over using a listview? When should each one be used?

推荐答案

我已经放弃了ListView控件为DataGrid在.net 4,因为模板化的列更容易。

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

布局也比较合理,而且我也不需要记住设置Horizo​​ntalContentAlignment拉伸以获取单元格内容覆盖细胞。功能另外一个不错位是在DataGrid上,这样可免除使用CellTemplateSelector编辑单元格时,得到不同的控制我的编辑模板。

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.