wpf 双击行。。获得行信息

void mydataGird_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            Point aP = e.GetPosition(mydataGird);
            IInputElement obj = mydataGird.InputHitTest(aP);
            DependencyObject target = obj as DependencyObject;

            int i = 0;
            while (target != null)
            {
                if (target is DataGridRow)
                {
                    DataGridRow aDGR = target as DataGridRow;
                    var  item = aDGR.Item;
                    break;
                }
                target = VisualTreeHelper.GetParent(target);
                i++;
            }

       
        }
View Code

 

posted @ 2013-07-13 23:22  法的空间  阅读(770)  评论(0编辑  收藏  举报