C# – Adding rows to wpf datagrid

c++datagridrowswpf

I need to select a set of rows from one wpf toolkit datagrid and want to add it in another wpf toolkit datagrid. The code I used is as follows:

foreach(DataRowView row in MyFirstDataGrid.SelectedItems)
{
  MySecondDataGrid.Items.Add(row);
}

But the problem here is, it just adds empty rows in the second datagrid without any contents…. Can anyone please help me in this issue????

Thanks and Regards,
Suba.

Best Solution

Are the grids bound? Could you just add it to the second grid's item source?

Related Question