public static bool IsTheMouseOnTargetRow(this Visual target, GetDragPosition pos)
        {
            if (target == null || pos == null)
            {
                return(false);
            }

            var posBounds = VisualTreeHelper.GetDescendantBounds(target);
            var mousePos  = pos((IInputElement)target);

            return(posBounds.Contains(mousePos));
        }
        public static int GetDataGridItemCurrentRowIndex(this DataGrid grid, GetDragPosition pos)
        {
            if (grid == null || pos == null)
            {
                return(-1);
            }

            var curIndex = -1;

            for (var i = 0; i < grid.Items.Count; i++)
            {
                var item = grid.GetDataGridRowItem(i);
                if (!IsTheMouseOnTargetRow(item, pos))
                {
                    continue;
                }

                curIndex = i;
                break;
            }

            return(curIndex);
        }