How can I add a DataGridRow to an unbound DataGrid?
I know it's a good idea to use data binding to a DataTable, etc. but if I wanted to add a Row manually to a DataGrid that I've already added columns to, how would I do that? Google doesn't seem to have any answers, only for DataGridViews.
Any improvement on this trial code?
Datagrid_Main.AutoGenerateColumns = false;
for (int i = 0; i < 6; i++)
{
DataGridTextColumn dc1 = new DataGridTextColumn();
dc1.Header = i.ToString();
Datagrid_Main.Columns.Add(dc1);
}
DataGridRow dgr1 = new DataGridRow();
Datagrid_Main.Items.Add(dgr1);
I'm looking for some equivalent to:
DataGridViewRow row = (DataGridViewRow)walletDataGridView.Rows[0].Clone();
row.Cells[0].Value = "Value";
row.Cells[1].Value = "Test1";
row.Cells[2].Value = "12.01";
walletDataGridView.Rows.Add(row);