当用户点击该单元格时,我想捕获数据网格中单元格的值。我不想编辑单元格,只需单击它并捕获值,这样我就可以在viewmodel中用它做一些事情。帮助赞赏。
答案 0 :(得分:0)
如果你的DataGrid是
<Controls:DataGrid Name="versionInfo" PreparingCellForEdit="grid_ForEdit" >
处理程序是
private void grid_ForEdit(object sender, DataGridPreparingCellForEditEventArgs e)
{
TextBox box = e.EditingElement as TextBox;
// box.Text contains the text in that cell
}