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);
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 为返回行