private bool IsTheMouseOnTargetRow(Visual target, MainWindow.GetDragDropPosition position)
        {
            if (target == null)
            {
                return(false);
            }

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

            return(posBounds.Contains(mousePos));
        }
        private int GetDataGridItemCurrentRowIndex(DataGrid grid, MainWindow.GetDragDropPosition pos)
        {
            var curIndex = -1;

            for (var i = 0; i < grid.Items.Count; i++)
            {
                var itm = this.GetDataGridRowItem(grid, i);
                if (this.IsTheMouseOnTargetRow(itm, pos))
                {
                    curIndex = i;
                    break;
                }
            }

            return(curIndex);
        }