Write DataGrid to CSV file in WPF app
Write DataGrid to CSV file in WPF app
This post shows how to write a DataGrid in WPF to a CSV file. We will export the data contained in the DataGrid along with the column headers to a CSV file. Here’s how it can be done.
Step 1: Build a CSV string from the DataGrid
Use the following method to convert a DataGrid to a CSV string.
public static string DataTable2CSV(DataGrid table, string separator=",") { object[,] data =…
View On WordPress







