private void DetachAdorners() { if (_insertAdorner != null) { _insertAdorner.Destroy(); _insertAdorner = null; } if (_dragAdorner != null) { _dragAdorner.Destroy(); _dragAdorner = null; } }
private void InitializeInsertAdorner(ItemsControl itemsControl, DragEventArgs e) { if (_insertAdorner == null) { var adornerLayer = AdornerLayer.GetAdornerLayer(itemsControl); UIElement itemContainer = Helper.GetItemContainerFromPoint(itemsControl, e.GetPosition(itemsControl)); if (itemContainer != null) { bool isPointInTopHalf = Helper.IsPointInTopHalf(itemsControl, e); bool isItemsControlOrientationHorizontal = Helper.IsItemControlOrientationHorizontal(itemsControl); _insertAdorner = new InsertAdorner(isPointInTopHalf, isItemsControlOrientationHorizontal, itemContainer, adornerLayer); } } }