我想从我在DataGrid中双击的行中返回单元格 0 的值。到目前为止,我可以从所有行返回单元格 0 的值,但我只想要双击行的单元格 0 值。
这类似于我在示例代码中遍历的这个问题。
private void dataGrid_MouseDoubleClick(object sender, MouseButtonEventArgs e)
{
foreach (DataRowView row in dataGrid.Items)
{
string text = row.Row.ItemArray[0].ToString();
Debug.WriteLine(text);
}
}