Convert and use DataTable in WPF DataGrid?

后端 未结 3 750
臣服心动
臣服心动 2020-12-09 19:46

In normal WinForm application you can do that:

DataTable dataTable = new DataTable();
dataTable = dataGridRecords.DataSource;

but how to do

3条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-09 20:32

    You don't need the DataViewAsDataTable method. Just do the following:

    DataTable dt = ((DataView)dataGrid1.ItemsSource).ToTable();

提交回复
热议问题