Exemple #1
0
        private void RemoveAdorners()
        {
            if (_draggedAdorner != null)
            {
                AdornerLayer.Remove(_draggedAdorner);
            }
            _draggedAdorner = null;

            if (_insertionAdorner != null)
            {
                AdornerLayer.Remove(_insertionAdorner);
            }
            _insertionAdorner = null;
        }
Exemple #2
0
        private void UpdateInsertionAdorner(Point currentPosition, DependencyObject obj)
        {
            FrameworkElement listViewItem = Helpers.WPFVisualHelper.FindAncestor <ListBoxItem>(obj);

            if (listViewItem != null)
            {
                if (_insertionAdorner == null)
                {
                    _insertionAdorner = new InsertionAdorner(listViewItem);
                    AdornerLayer.Add(_insertionAdorner);
                }

                currentPosition = TargetElement.TranslatePoint(currentPosition, listViewItem);
                double halfHeight = listViewItem.ActualHeight / 2;

                _insertionAdorner.Position = (currentPosition.Y <= halfHeight) ?
                                             InsertionAdorner.InsertionPosition.Top : InsertionAdorner.InsertionPosition.Bottom;
            }
            else
            {
                RemoveAdorners();
            }
        }