lundi 16 avril 2018

pass selected rows(via checkbox) from DataGrid to another

simply i want to Send Rows Only checked in DataGrid1 to DataGrid2

i have find this on the net but may not be used for WPF

Showing any chance or possibility would be appreciate.

private void btnSend_Click(object sender, RoutedEventArgs e)
    {
        DataTable dt = new DataTable();
        dt.Columns.Add("Title");
        dt.Columns.Add("Date");
        dt.Columns.Add("events");

        foreach (GridViewRow row in GridView1.Rows)
            if (((CheckBox)row.Cells[0]).Checked)
                dt.Rows.Add(row.Cells[1].Text, row.Cells[2].Text, row.Cells[3].Text);

}




Aucun commentaire:

Enregistrer un commentaire