/// <summary>
 /// Update the position of the insertion point marker
 /// </summary>
 /// <param name="itemsControl"></param>
 /// <param name="e"></param>
 private void UpdateInsertAdorner(ItemsControl itemsControl, DragEventArgs e)
 {
     if (this._insertAdorner != null)
     {
         this._insertAdorner.InTopHalf = DragUtilities.IsPointInTopHalf(itemsControl, e);
         this._insertAdorner.InvalidateVisual();
     }
 }
        /// <summary>
        /// Determine the proper insertion index
        /// </summary>
        /// <param name="itemsControl"></param>
        /// <param name="e"></param>
        /// <returns></returns>
        private static int FindInsertionIndex(ItemsControl itemsControl, DragEventArgs e)
        {
            UIElement dropTargetContainer = DragUtilities.GetItemContainerFromPoint(itemsControl, e.GetPosition(itemsControl));

            if (dropTargetContainer != null)
            {
                int index = itemsControl.ItemContainerGenerator.IndexFromContainer(dropTargetContainer);
                return(DragUtilities.IsPointInTopHalf(itemsControl, e) ? index : index + 1);
            }
            return(itemsControl.Items.Count);
        }
 /// <summary>
 /// Initialize the insertion point marker
 /// </summary>
 /// <param name="itemsControl"></param>
 /// <param name="e"></param>
 private void InitializeInsertAdorner(ItemsControl itemsControl, DragEventArgs e)
 {
     if (this._insertAdorner == null && this.ShowInsertAdorner)
     {
         UIElement itemContainer = DragUtilities.GetItemContainerFromPoint(itemsControl, e.GetPosition(itemsControl));
         if (itemContainer != null)
         {
             this._insertAdorner = new InsertAdorner(DragUtilities.IsPointInTopHalf(itemsControl, e),
                                                     DragUtilities.IsItemControlOrientationHorizontal(itemsControl),
                                                     itemContainer, AdornerLayer.GetAdornerLayer(itemsControl), itemsControl);
         }
     }
 }