您的位置:首页 > 其它

WPF DataGrid 鼠标双击 选中的 DataGridRow 及 行对应数据

2012-02-22 11:22 399 查看
Point aP = e.GetPosition(this.dgUsers);

IInputElement obj = this.dgUsers.InputHitTest(aP);

System.Windows.DependencyObject target = obj as System.Windows.DependencyObject;

while (target != null)

{

if (target is Microsoft.Windows.Controls.DataGridRow)

{

Microsoft.Windows.Controls.DataGridRow aDGR = target as Microsoft.Windows.Controls.DataGridRow;

DataRowView theDRV = aDGR.Item as DataRowView;

SelectedRow = theDRV.Row;

break;

}

target = VisualTreeHelper.GetParent(target);

}

///SelectedRow 为返回行
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: