DataGrid get selected rows' column values

前端 未结 8 1343
你的背包
你的背包 2020-11-27 06:11

I\'m trying to get the values of each column of a selected row in a DataGrid. This is what I have:

private void dataGrid1_CellEditEnding(object sender, DataG         


        
8条回答
  •  清歌不尽
    2020-11-27 06:37

    UPDATED

    To get the selected rows try:

    IList rows = dg.SelectedItems;
    

    You should then be able to get to the column value from a row item.

    OR

    DataRowView row = (DataRowView)dg.SelectedItems[0];
    

    Then:

    row["ColumnName"];
    

提交回复
热议问题