如何在不使用数据绑定的情况下从列表填充WPF DataGrid?

问题描述:



我想知道如何在不使用数据绑定和在DataGrid中手动定义列的情况下,用对象列表填充WPF DataGrid.

另外,如何在不使用数据绑定的情况下从MySQL或SQL数据库填充DataGrid?有没有一种方法可以单击DataGrid行并删除该行,并使DataGrid刷新并排除已删除的行,而不必重新加载WPF窗口.

在此先感谢您的帮助.

Hi,

I would like to know how to populate a WPF DataGrid with a list of objects without using data binding and manually defining columns in DataGrid.

Also how can you populating a DataGrid from a MySQL or SQL database without using data binding? Is there a way to click on a DataGrid row and delete that row and have the DataGrid refresh and exclude deleted row without having to reload WPF window.

Thanks in advance for any help.

关于WPF的AFAIK,常规Datagrid绑定(asp.net)和WPF Datagrid绑定在您执行操作时没有太大区别它在服务器端.因此,我希望此链接对您有用.
使用DataGrid控件绑定ArrayList [
AFAIK about WPF, there is not much difference in normal Datagrid binding (asp.net) and WPF Datagrid binding when you are doing it on server side. So I hope this link will be useful to you.
Binding an ArrayList with DataGrid Control[^]


Anurag