We need to get the value from the first cell of the DataGrid row.

enter image description here

How to do it?

  • And what do you see in a datagrid? A collection of some objects? - Andrei NOP
  • @AndrewNOP I get a sample from the database and attach it to the DataGrid. - J. Doe

1 answer 1

Found the answer. Everything turned out to be quite simple.

private void DataGridRow_MouseDoubleClick(object sender, MouseButtonEventArgs e) { DataGridRow row = sender as DataGridRow; if (row != null) { // dg - мой DataGrid TextBlock tbl = dg.Columns[0].GetCellContent(row) as TextBlock; Data = tbl.Text; } }