A lightweight adorner which renders a visual that can follow the mouse cursor, such as during a drag-and-drop operation.
Used In: http://www.codeproject.com/KB/WPF/ListViewDragDropManager.aspx
Inheritance: SingleChildAdornerBase
コード例 #1
0
 private void RemoveAdornerLayer()
 {
     AdornerLayer adornerLayer = AdornerLayer.GetAdornerLayer(adornerContainer);
     if (adornerLayer != null) {
         adornerLayer.Remove(pickupDragAdorner);
         pickupDragAdorner = null;
     }
 }
コード例 #2
0
        private bool InitializeAdornerLayer()
        {
            // Create a brush which will paint the ListViewItem onto
            // a visual in the adorner layer.
            VisualBrush brush = new VisualBrush(pickupElement);

            adornerContainer = (UIElement)this.Parent;

            // Create an element which displays the source item while it is dragged.
            this.pickupDragAdorner = new DragAdorner(adornerContainer, pickupElement.RenderSize, brush);
            this.pickupDragAdorner.UseLayoutRounding = true;
            this.pickupDragAdorner.SnapsToDevicePixels = true;

            AdornerLayer layer = AdornerLayer.GetAdornerLayer(adornerContainer);
            if (layer != null) {
                layer.Add(pickupDragAdorner);
                return true;
            }
            return false;
        }