WPF Toolkit DataGrid SelectionChanged Getting Cell Value

后端 未结 5 838
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-09 00:13

Please help me, Im trying to get the value of Cell[0] from the selected row in a SelectionChangedEvent.

I am only managing to get lots of different Microsoft.Windows

5条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-09 01:17

    This will give you the current selected row in the DataGrid in WPF:-

    DataRow dtr = ((System.Data.DataRowView)(DataGrid1.SelectedValue)).Row;
    

    Now to get the cell value just write dtr[0], dtr["ID"], etc.

提交回复
热议问题