tags:

views:

2318

answers:

2

Hi all,

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.

A: 

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

Cody C
A: 

I think even if you defined the same columns, it doesn't just work if you add the rows to the second datagrid. instead, if both grids have an ItemsSource of the same type, add it to the itemsSource of the second grid. Should work if it's an ObservableCollection.

Botz3000