// Copyright (C) Josh Smith - January 2007 using System.Windows; using System.Windows.Media; using System.Windows.Shapes; namespace WPF.JoshSmith.Adorners { /// <summary> /// A lightweight adorner which renders a visual that can follow the mouse cursor, /// such as during a drag-and-drop operation. /// </summary> /// <remarks> /// Used In: http://www.codeproject.com/KB/WPF/ListViewDragDropManager.aspx /// </remarks> public class DragAdorner : SingleChildAdornerBase { #region Constructor /// <summary> /// Initializes a new instance of DragAdorner. /// </summary> /// <param name="adornedElement">The element being adorned.</param> /// <param name="size">The size of the adorner.</param> /// <param name="brush">A brush with which to paint the adorner.</param> public DragAdorner(UIElement adornedElement, Size size, Brush brush) : base(adornedElement) { Rectangle rect = new Rectangle(); rect.Fill = brush; rect.Width = size.Width; rect.Height = size.Height; rect.IsHitTestVisible = false; base.child = rect; } #endregion // Constructor } }
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.
This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)