In normal WinForm application you can do that:
DataTable dataTable = new DataTable();
dataTable = dataGridRecords.DataSource;
but how to do that with the WPF datagrid?
dataTable = dataGridRecords.ItemsSource;
won't work either.
In normal WinForm application you can do that:
DataTable dataTable = new DataTable();
dataTable = dataGridRecords.DataSource;
but how to do that with the WPF datagrid?
dataTable = dataGridRecords.ItemsSource;
won't work either.
try this
You don't need the
DataViewAsDataTable
method. Just do the following:DataTable dt = ((DataView)dataGrid1.ItemsSource).ToTable();
In WPF you don't do this
Instead you do
In order to get DataTable back you can do something like this