WPF 工具包中的 WPF DataGrid 与 ListView - 有什么好处?

发布于 2024-07-27 13:44:24 字数 201 浏览 5 评论 0原文

我非常了解 ListView,但从未看过 DataGrid

我的问题很简单 - 如果您不需要在列表中进行编辑,与 ListView 相比,DataGrid 是否提供任何优势? 另外,使用 DataGrid 是否有缺点(更复杂、性能、错误、难以设计样式等)?

I know ListView pretty well, but never looked at DataGrid.

My question is simple - if you do not need editing in the list, does DataGrid provide any benefits comparing to ListView?
Also, are there disadvantages of using DataGrid (more complex, performance, bugs, hard to style, etc...)?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

天冷不及心凉 2024-08-03 13:44:24

ListView 是一个只读控件。 通常的用法是将列表与由文本框组成的“详细信息视图”同步。

DataGrid 并不缺少 ListView 所拥有的任何东西,例如多重选择模式、样式等。但是,它确实提供了对 ListView 之上的某些功能的支持:

  • 数据就地编辑

  • 事务性编辑

  • 自动列生成

  • RowDetails 设置

基本上问题是 -你想要就地编辑吗? 如果是这样,DataGrid 是一个显而易见的选择。 如果不是的话,两者非常相似。

ListView is a read-only control. The usual usage is to synchronize the list with a 'details view' comprised of TextBoxes.

The DataGrid does not lack anything that the ListView possesses, such as multiple selection modes, styling, etc. It does, however, provide support for some features on top of the ListView:

  • In-place editing of data

  • Transactional edits

  • Auto-column generation

  • Setting of RowDetails

Basically the question is - do you want in-place editing? If so, the DataGrid is an obvious choice. If not, the two are quite similar.

等待圉鍢 2024-08-03 13:44:24

DataGrid 允许用户通过单击列标题对项目进行排序。

DataGrid lets user sort the items by clicking on column headers.

丑丑阿 2024-08-03 13:44:24

DataGrid 的另外两个优点:

  1. 固定列和列标题。
  2. 标题的样式比 ListView 中的样式更容易。

Two more advantages of the DataGrid:

  1. Fixed Columns and Column Headers.
  2. Headers are styled more easily than in ListView.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文