WPF DataGrid Vs Windows Forms DataGridView

后端 未结 5 641
再見小時候
再見小時候 2020-12-09 10:53

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 add

5条回答
  •  我在风中等你
    2020-12-09 11:14

    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.

提交回复
热议问题