I have a Datagrid formed by binding observablecollection, Now i want to provide Export to excel Functiom, So i need to Convert by datagrid to dataset or dataview.
public ObservableCollection<DataSourceVM> Backends { get; set; }
private void StartExport(String filepath)
{
try
{
DataTable bs = _dataGrid.ItemsSource as DataTable;
_dataSet = bs.DataSet as DataSet;
}
catch (Exception e1)
{
MessageBox.Show("error");
}
}
The ItemSource Contains a baseclass and Backend entity class