I have a DataTable with the following information:
Column1 | Column2
1 | A
2 | B
3 | C
4 | D
With this DataTable I would like to load a DataGrid using the first column of the DataTable to be the Row Header, thus
A B C D
1
2
3
4
Just put Column2 (at the top) I got it in a way, passing the data from DataTable1 to DataTable2 so I could load it into the DataGrid as follows:
where DtGrade is the DataTable to receive the top column
for (int i = 0; i < dt.Rows.Count; i++)
{
dtGrade.Columns.Add(dt.Rows[i][1].ToString());
}
gvDados.ItemsSource = null;
gvDados.ItemsSource = dtGrade.DefaultView;
Now I would like to add the columns on the left side.