.net - ListView 与数据网格

标签 .net wpf listview gridview datagrid

与使用 ListView 相比,使用数据网格控件的主要优势是什么?什么时候应该使用每一个?

最佳答案

需要考虑的几点 Colin Eber已在 DataGrid vs GridView 中声明讨论:

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


还有一个重要的:
  • 通过单击列标题,DataGrid 具有内置的排序支持。虽然添加排序到 ListView/GridView 是 absolutely possible ,我宁愿在 DataGrid 中提供开箱即用的这类东西。
  • 关于.net - ListView 与数据网格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3174428/

    相关文章:

    .net - 如何在c# RSA中使用私钥加密并使用公钥解密

    c# - 设置默认值后,从 WebBrowser 控件打印到错误的打印机

    C# Native Interop - 为什么大多数库使用 LoadLibrary 和委托(delegate)而不是 SetDllDirectory 和简单的 DllImport

    c# - WPF - 强制 ShowDialog 返回

    c# - 如何在ListView中将两列的值连接成一列

    android - Listview 替换第一个项目而不是创建新项目

    c# - Math.Round() 似乎不一致

    c# - WPF-在第一个组合框选择上启用第二个组合框

    wpf - 更改 WPF 标题栏背景颜色

    c# - 在 ListView 控件中显示数据表