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

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

问题描述

我有WPF和Windows窗体的经验,但是只使用Windows Forms DataGridView而不是WPF DataGrid(仅包含在.Net 4中,或者可以从Codeplex添加到.Net 3.5中)。我将要大量使用这些控件之一的应用程序大量的数据,并且读取性能是WPF DataGrid的一个问题,所以我可能会坚持Windows窗体DataGridView ..是这样吗?



我不想使用第三方控件。



Windows窗体DataGridView是否提供了比WPF DataGrid更大的性能数据量?



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

此外,我想使用ADO与DataTable,我觉得更适合Windows窗体..

解决方案

对于您的需求,除非有其他要求引导您进入WPF,否则我建议使用WinForms DataGridView。



WPF DataGrid是通过Codeplex提供的,作为带外版本,即这些控件最终将进入WPF API,但是早期在codeplex上发布,以便我们可以在下一个主要的.NET版本之前从中受益。您可以使用.NET 4.0或Codeplex DataGrid。据我所知,他们是一样的。 WPF DataGrid与DataTables相当不错。请参阅以下文章中的示例:



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



然而,WPF框架和视觉效果稍微超过WinForms。此外,WinForms DataGridView非常成熟。



对于非常大的数据集,WinForms DataGridView具有WPF DataGrid中不存在的一个功能,对于非常大的网格(百万行),这是一个虚拟模式:



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



也被称为数据虚拟化。在这种模式下,您告诉网格数据中有多少行,然后处理事件以填充单元格。这个比例很好。我已经使用这个大规模和复杂的网格。



WPF具有UI虚拟化,这是一种UI控制回收,而不是数据虚拟化。



希望有帮助。


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.

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

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?

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

解决方案

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

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

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

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 has UI virtualization which is a form of UI control recycling, but not data virtualization.

Hope that helps.

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

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