Q:

Saving selected items of one DataGrid and presenting it in another DataGrid Wpf

I have 2 DataGrids.
In the first DataGrid i have a lot of rows (the grid is binded to the table, i use linq to sql). The user choses the rows he wants , and then he clicks the "add" button. When "add" button is clicked i need to present the selected rows in the second DataGrid (which is located next to the first grid). How can i do it?
( When I bind the second grid to the selected items of the first grid it changes every time I change the selected items of the first grid and that is not what I want to achive. I need that the user will see what he chose and could click the rows in the first grid whithout changing he selecred items that presented in the second grid.... )

A:

Create a Command in your ViewModel that expects a list of selected datagrid items as a parameter. Execute this command when the user clicks the Add button, and bind the CommandParameter to DataGrid.SelectedItems.

