WPF DataGrid与DataGridView [英] WPF DataGrid vs DataGridView

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

问题描述

在WPF中看起来没有DataGridView这样的东西,看起来我不得不使用DataGrid。

In WPF it looks like there's no such thing as DataGridView and it looks like I have to use DataGrid instead.

我在WindowsForm中有一个项目,我尝试重新编写-create in WPF application。

I have a project in WindowsForm that I try to re-create in a WPF application.

DataGrid似乎不适用于.ScrollBars .Dock。  AutoSizeRowsMo​​de .DataBindingComplete ...等等。

The DataGrid doesn't seem to work with .ScrollBars .Dock . AutoSizeRowsMode .DataBindingComplete...and so on.

  dgDataGrid.ScrollBars = ScrollBars.Both;
                            dgDataGrid.Dock = DockStyle.Fill;
                            dgDataGrid.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells;
                            dgDataGrid.DataBindingComplete += dgDataGrid_DataBindingComplete;


我该使用什么?

What do I use instead?




推荐答案

>> DataGrid似乎不适用于.ScrollBars .Dock。  AutoSizeRowsMo​​de .DataBindingComplete ...等等。

>>The DataGrid doesn't seem to work with .ScrollBars .Dock . AutoSizeRowsMode .DataBindingComplete...and so on.

是的,存在一些差异wpf与winforms之间。例如WPF具有极其强大的布局机制。一些属性不适合WPF这样的Dock。
...

Yes, there are some differences between wpf with winforms.Such as WPF has extremly powerfull layouting mechanizm.Some properties will not suitable for WPF such Dock. ...



>>我该使用什么?


>>What do I use instead?

如果您是使用Winforms的开发人员,您会发现WPF比WinForms更复杂,因此学习时间更长。一旦你很好地学习了WPF,你就可以极其快速地学习它,但学习曲线比WinForms更陡峭。

If your are a developer using Winforms, you will find WPF is more complex than WinForms and thus it takes longer to learn. Once you learn WPF well, you can be extremly fast with it, but the learning curve is steeper than WinForms.

  DataGrid  与Windows窗体中的DataGridView和ASP.NET中的GridView类似。它提供了一种灵活的方式
来显示行和列中的数据集合而不是DataGridView。您将找到更好的绑定方案,模板显示中的更多可扩展性,以及用于修改WPF GridView中的单个单元格/行/列的更丰富的界面。

 DataGrid  in WPF is similar with DataGridView in Windows Forms and GridView in ASP.NET . It provides a flexible way to display a collection of data in rows and columns than DataGridView . You'll find a better binding scheme, more extensibility in the template display, and a richer interface for modifying individual cells/rows/columns in WPF GridView .

最好的问候,

Bob

Bob








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

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