void IDropTarget.DragOver(UIElement draggedElement, Point mousePosition) { ColumnManagerCell cell = draggedElement as ColumnManagerCell; if (cell != null) { HierarchicalGroupByControlNode hierarchicalGroupByControlNode = this.GetHierarchicalGroupByControlNodeFromColumnManagerCell(cell); // It may not be visible if (hierarchicalGroupByControlNode != null) { hierarchicalGroupByControlNode.ShowFarDropMark(cell, mousePosition); } } else { HierarchicalGroupByItem hierarchicalGroupByItem = draggedElement as HierarchicalGroupByItem; if (hierarchicalGroupByItem == null) { return; } HierarchicalGroupByControlNode hierarchicalGroupByControlNode = this.GetHierarchicalGroupByControlNodeFromHierarchicalGroupByItem(hierarchicalGroupByItem); Debug.Assert(hierarchicalGroupByControlNode != null, "CanDrop should have returned false"); if (hierarchicalGroupByControlNode == null) { throw new DataGridInternalException("A HierarchicalGroupByControlNode must exist for every level."); } hierarchicalGroupByControlNode.ShowFarDropMark(mousePosition); } }
void IDropTarget.DragOver(UIElement draggedElement, Point mousePosition) { ColumnManagerCell cell = draggedElement as ColumnManagerCell; if (cell != null) { HierarchicalGroupByControl parentGBC = GroupingHelper.GetHierarchicalGroupByControl(this); if (parentGBC == null) { throw new DataGridInternalException("The hierarchical group-by control node must be rooted by a HierarchicalGroupByControl."); } HierarchicalGroupByControlNode hierarchicalGroupByControlNode = parentGBC.GetHierarchicalGroupByControlNodeFromColumnManagerCell(cell); if (hierarchicalGroupByControlNode == null) { throw new DataGridInternalException("A HierarchicalGroupByControlNode must exist for every level."); } hierarchicalGroupByControlNode.ShowFarDropMark(cell, mousePosition); } else { HierarchicalGroupByItem hierarchicalGroupByItem = draggedElement as HierarchicalGroupByItem; if (hierarchicalGroupByItem == null) { return; } HierarchicalGroupByControlNode draggedHierarchicalGroupByControlNode = HierarchicalGroupByItem.GetParentHierarchicalGroupByControlNode(hierarchicalGroupByItem); if (draggedHierarchicalGroupByControlNode == null) { throw new DataGridInternalException("draggedHierarchicalGroupByControlNode is null."); } if (draggedHierarchicalGroupByControlNode.GroupLevelDescriptions == this.GroupLevelDescriptions) { this.ShowFarDropMark(mousePosition); } else { // This HierarchicalGroupByItem does not belong this parent HierarchicalGroupByControlNode, display the DropMark on the correct one HierarchicalGroupByControl parentGBC = GroupingHelper.GetHierarchicalGroupByControl(this); if (parentGBC == null) { throw new DataGridInternalException("The hierarchical group-by control node must be rooted by a HierarchicalGroupByControl."); } HierarchicalGroupByControlNode hierarchicalGroupByControlNode = parentGBC.GetHierarchicalGroupByControlNodeFromHierarchicalGroupByItem(hierarchicalGroupByItem); Debug.Assert(hierarchicalGroupByControlNode != null, "CanDrop should have returned false"); if (hierarchicalGroupByControlNode == null) { throw new DataGridInternalException("A HierarchicalGroupByControlNode must exist for every level."); } hierarchicalGroupByControlNode.ShowFarDropMark(mousePosition); } } }