WPF DataGrid 与 Windows 窗体 DataGridView [英] WPF DataGrid Vs Windows Forms DataGridView

查看:43
本文介绍了WPF DataGrid 与 Windows 窗体 DataGridView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 WPF 和 Windows 窗体方面有经验,但是只使用了 Windows 窗体 DataGridView 而不是 WPF DataGrid(它只包含在 .Net 4 中,或者可以从 Codeplex 添加到 .Net 3.5,我理解).我即将开发一个使用这些控件之一来处理大量数据的应用程序,并且读取性能是 WPF DataGrid 的一个问题,所以我可能会坚持使用 Windows 窗体 DataGridView.. 是这种情况吗?

I have experience in WPF and Windows Forms, however have only used the Windows Forms DataGridView and not the WPF DataGrid (which was only included in .Net 4 or could be added to .Net 3.5 from Codeplex, I understand). I am about to devlop an app using one of these controls heavily for large amounts of data and have read performance is an issue with the WPF DataGrid so I may stick to the Windows Forms DataGridView.. Is this the case?

我不想使用第三方控件.

I do not want to use a 3rd party control.

对于大量数据,Windows 窗体 DataGridView 是否比 WPF DataGrid 提供显着的性能?

Does the Windows Forms DataGridView offer significant performance over the WPF DataGrid for large amounts of data?

如果我要使用 WPF,我宁愿使用 .Net 3.5S SP1,除非 .Net 4 中的 DataGrid 明显更好?

If I were to use WPF I would prefer to use .Net 3.5S SP1, unless the DataGrid in the .Net 4 is significantly better?

我还想将 ADO 与 DataTable 一起使用,我觉得它更适合 Windows 窗体..

Also I want to use ADO with DataTable's which I feel is better suited to Windows Forms..

推荐答案

对于您的需求,除非您有其他要求引导您使用 WPF,否则我会推荐 WinForms DataGridView.

For your needs, unless you have other requirements that steer you towards WPF, I would recommend the WinForms DataGridView.

WPF DataGrid 是通过 Codeplex 提供的,作为带外"版本,即这些是最终将进入 WPF API 的控件,但在 Codeplex 上提前发布,以便我们之前可以从中受益下一个主要的 .NET 版本.您可以使用 .NET 4.0 或 codeplex DataGrid.据我所知,它们是一回事.WPF DataGrid 与 DataTables 配合得很好.请参阅我以下文章中的示例:

The WPF DataGrid was made available via Codeplex, as an 'out of band' release, i.e. these are control that will eventually make their way into the WPF APIs, but are released on codeplex early so that we can benefit from them before the next major .NET release. You can use either the .NET 4.0 or codeplex DataGrid. As far as I know they are one and the same. The WPF DataGrid plays quite nicely with DataTables. See the examples in my following article:

http://www.codeproject.com/KB/WPF/WPFDataGridExamples.aspx

然而,WPF 框架和视觉效果比 WinForms 稍微重量级一些.另外,WinForms DataGridView 非常成熟.

However, the WPF framework and visuals are slightly more heavyweight than WinForms. Also, the WinForms DataGridView is very mature.

对于非常大的数据集,WinForms DataGridView 有一个 WPF DataGrid 没有的功能,这对于非常大的网格(数百万行)至关重要,这是一种虚拟模式:

For very large datasets, the WinForms DataGridView has one feature that is not present in the WPF DataGrid, which is vital for very large grids (millions of rows), this is a virtual mode:

http://msdn.microsoft.com/en-us/library/ms171622.aspx

也称为数据虚拟化.在这种模式下,您告诉网格数据中有多少行,然后处理事件以填充单元格.这很好地扩展.我已将其用于大量复杂的网格.

Known also as Data-Virtualization. In this mode, you tell the grid how many rows there are in your data, then handle events to populate the cells. This scales very well. I have used this for massive and complex grids.

WPF 具有 UI 虚拟化,这是一种 UI 控件回收的形式,但不具有数据虚拟化.

WPF has UI virtualization which is a form of UI control recycling, but not data virtualization.

希望有所帮助.

这篇关于WPF DataGrid 与 Windows 窗体 DataGridView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆