private void RemoveInsertionAdorner() { if (insertionAdorner != null) { insertionAdorner.Detach(); insertionAdorner = null; } }
private void CreateInsertionAdorner() { if (targetItemContainer != null) { // Here, I need to get adorner layer from targetItemContainer and not targetItemsControl. // This way I get the AdornerLayer within ScrollContentPresenter, and not the one under AdornerDecorator (Snoop is awesome). // If I used targetItemsControl, the adorner would hang out of ItemsControl when there's a horizontal scroll bar. AdornerLayer adornerLayer = AdornerLayer.GetAdornerLayer(targetItemContainer); insertionAdorner = new InsertionAdorner(hasVerticalOrientation, isInFirstHalf, targetItemContainer, adornerLayer); } }