private static bool TryHitTestCell( ColumnManagerCell cell, Point point, UIElement dragContainer ) { Row parentRow = cell.ParentRow; if( parentRow == null ) return true; FixedCellPanel fixedCellPanel = parentRow.CellsHostPanel as FixedCellPanel; if( fixedCellPanel == null ) return true; Decorator scrollingCellsDecorator = fixedCellPanel.ScrollingCellsDecorator; if( !scrollingCellsDecorator.IsAncestorOf( cell ) ) return true; Point cellPoint = cell.TranslatePoint( ColumnReorderingDragSourceManager.EmptyPoint, dragContainer ); Rect cellRect = new Rect( cellPoint.X, cellPoint.Y, cell.ActualWidth, cell.ActualHeight ); Point scrollingCellsDecoratorPoint = scrollingCellsDecorator.TranslatePoint( ColumnReorderingDragSourceManager.EmptyPoint, dragContainer ); Rect scrollingCellsDecoratorRect = new Rect( scrollingCellsDecoratorPoint.X, scrollingCellsDecoratorPoint.Y, scrollingCellsDecorator.ActualWidth, scrollingCellsDecorator.ActualHeight ); if( !cellRect.IntersectsWith( scrollingCellsDecoratorRect ) ) { return false; } else if( !scrollingCellsDecoratorRect.Contains( point ) ) { return false; } return true; }
private void SetPopupDragAdorner( ColumnManagerCell columnManagerCell ) { if( columnManagerCell == null ) return; if( m_popupDraggedElementAdorner != null ) { this.AdornerLayerInsideDragContainer.Remove( m_popupDraggedElementAdorner ); m_popupDraggedElementAdorner = null; } // Get the Rect for the DataGridControl DataGridControl dataGridControl = this.DraggedDataGridContext.DataGridControl; Rect dataGridControlRect = new Rect( 0d, 0d, dataGridControl.ActualWidth, dataGridControl.ActualHeight ); Point elementToDataGridControl = columnManagerCell.TranslatePoint( ColumnReorderingDragSourceManager.EmptyPoint, dataGridControl ); // Get the Rect for the element that request a ghost Rect elementRect = new Rect( elementToDataGridControl, columnManagerCell.RenderSize ); // This is a special case with the current Element that is always be layouted, but can be out of view if( !elementRect.IntersectsWith( dataGridControlRect ) ) return; AnimatedDraggedElementAdorner adorner = new AnimatedDraggedElementAdorner( columnManagerCell, this.AdornerLayerInsideDragContainer, true ); adorner.AdornedElementImage.Opacity = 0d; this.ApplyContainerClip( adorner ); this.AdornerLayerInsideDragContainer.Add( adorner ); m_popupDraggedElementAdorner = adorner; }