What I must do:
I Need to load a Database, search entries and Export the selected columns.
The Problem:
I got
There is a SelectedItems
property that will return the selected items in the DataGrid
. In your case you could each such item to a DataRowView
, e.g.:
StringBuilder sb = new StringBuilder();
foreach(var selectedRow in DataGrid_Table.SelectedItems.OfType<DataRowView>())
{
foreach(DataColumn column in selectedRow.DataView.Table.Columns)
{
sb.Append(selectedRow[column.ColumnName] + ";");
}
sb.Append(Environment.NewLine);
}
string export = sb.ToString();