Class RadDragDropService
Represents a service that manages drag and drop operations with visual feedback, cursor management, and event handling.
Inherited Members
Namespace: Telerik.WinControls
Assembly: Telerik.WinControls.dll
Syntax
public class RadDragDropService : RadService, IDisposable, INotifyPropertyChanged, ICustomTypeDescriptor, IMessageListener
Remarks
This service provides comprehensive drag and drop functionality including drag source detection, drop target validation, visual feedback with hint windows, cursor changes, and event notifications throughout the drag and drop lifecycle.
Constructors
RadDragDropService()
Initializes a new instance of the RadDragDropService class.
Declaration
public RadDragDropService()
Remarks
Sets up default cursors, hint window configuration, and initializes the service with default drag and drop behavior settings.
Fields
beginPoint
Declaration
protected Point? beginPoint
Field Value
|
System.Nullable<System.Drawing.Point>
|
messageFilterAdded
Declaration
protected bool messageFilterAdded
Field Value
|
System.Boolean
|
xOutlineFormOffset
Declaration
protected int xOutlineFormOffset
Field Value
|
System.Int32
|
yOutlineFormOffset
Declaration
protected int yOutlineFormOffset
Field Value
|
System.Int32
|
Properties
CanCommit
Determines whether a drop operation will be committed (a valid drop target is found).
Declaration
protected bool CanCommit { get; }
Property Value
|
System.Boolean
|
DropLocation
Gets the current drop location in the context of the current target.
Declaration
public Point DropLocation { get; }
Property Value
|
System.Drawing.Point
|
DropTarget
Gets current drop target, where the mouse cursor points.
Declaration
public ISupportDrop DropTarget { get; }
Property Value
|
ISupportDrop
|
HintWindow
Gets the Hint window.
Declaration
protected RadLayeredWindow HintWindow { get; }
Property Value
|
RadLayeredWindow
The hint window. |
Initialized
Declaration
protected bool Initialized { get; }
Property Value
|
System.Boolean
|
InvalidCursor
Gets or sets the cursor to be used when a valid drop target is hit-tested.
Declaration
public Cursor InvalidCursor { get; set; }
Property Value
|
System.Windows.Forms.Cursor
|
UseDefaultPreview
Determines whether a default preview is generated for a ISupportDrag instance if its GetPreview method returns null.
Declaration
public bool UseDefaultPreview { get; set; }
Property Value
|
System.Boolean
|
ValidCursor
Gets or sets the cursor to be used when a valid drop target is hit-tested.
Declaration
public Cursor ValidCursor { get; set; }
Property Value
|
System.Windows.Forms.Cursor
|
Methods
BeginDrag(Point, ISupportDrag)
Begins a drag pass. Allows for service automation.
Declaration
public void BeginDrag(Point mouseBeginPoint, ISupportDrag draggedObject)
Parameters
|
System.Drawing.Point
mouseBeginPoint
The position of the mouse cursor in screen coordinates. |
|
ISupportDrag
draggedObject
An instance of IDraggable that is dragged. |
CanStart(Object)
Declaration
protected override bool CanStart(object context)
Parameters
|
System.Object
context
|
Returns
|
System.Boolean
|
Overrides
Commit()
DisposeManagedResources()
Declaration
protected override void DisposeManagedResources()
Overrides
DoMouseMove(Point)
Mocks a mouse move to a specific point. Allows for service automation.
Declaration
public void DoMouseMove(Point mousePos)
Parameters
|
System.Drawing.Point
mousePos
|
EndDrag()
Ends a drag pass. Allows for service automation.
Declaration
public void EndDrag()
EndDrag(Point, RadControl)
Ends a drag pass. Allows for service automation.
Declaration
public void EndDrag(Point mouseEndPoint, RadControl targetControl)
Parameters
|
System.Drawing.Point
mouseEndPoint
The end position of the mouse cursor in screen coordinates. |
|
RadControl
targetControl
An instance of RadControl. |
GetDropTarget(Point, out Point)
Declaration
protected virtual ISupportDrop GetDropTarget(Point mousePosition, out Point resultDropLocation)
Parameters
|
System.Drawing.Point
mousePosition
|
|
System.Drawing.Point
resultDropLocation
|
Returns
|
ISupportDrop
|
HandleEscKeyDown()
Declaration
protected virtual void HandleEscKeyDown()
HandleLeftButtonUp()
Declaration
protected virtual void HandleLeftButtonUp()
HandleMouseMove(Point)
Declaration
protected virtual void HandleMouseMove(Point mousePos)
Parameters
|
System.Drawing.Point
mousePos
|
IsDropTargetValid(ISupportDrop)
Declaration
protected virtual bool IsDropTargetValid(ISupportDrop dropTarget)
Parameters
|
ISupportDrop
dropTarget
|
Returns
|
System.Boolean
|
OnPreviewDragDrop(RadDropEventArgs)
Declaration
protected virtual void OnPreviewDragDrop(RadDropEventArgs e)
Parameters
|
RadDropEventArgs
e
|
OnPreviewDragHint(PreviewDragHintEventArgs)
Declaration
protected virtual void OnPreviewDragHint(PreviewDragHintEventArgs e)
Parameters
|
PreviewDragHintEventArgs
e
|
OnPreviewDragOver(RadDragOverEventArgs)
Declaration
protected virtual void OnPreviewDragOver(RadDragOverEventArgs e)
Parameters
|
RadDragOverEventArgs
e
|
OnPreviewDragStart(PreviewDragStartEventArgs)
Declaration
protected virtual void OnPreviewDragStart(PreviewDragStartEventArgs e)
Parameters
|
PreviewDragStartEventArgs
e
|
OnPreviewDropTarget(PreviewDropTargetEventArgs)
Declaration
protected virtual void OnPreviewDropTarget(PreviewDropTargetEventArgs e)
Parameters
|
PreviewDropTargetEventArgs
e
|
PerformStart()
PerformStop()
PrepareContext()
Declaration
protected virtual bool PrepareContext()
Returns
|
System.Boolean
|
RestoreOriginalMouseCursor()
Declaration
protected virtual void RestoreOriginalMouseCursor()
SetHintWindowPosition(Point)
Declaration
protected virtual void SetHintWindowPosition(Point mousePt)
Parameters
|
System.Drawing.Point
mousePt
|
ShouldBeginDrag(Point, Point)
Declaration
public static bool ShouldBeginDrag(Point current, Point capture)
Parameters
|
System.Drawing.Point
current
|
|
System.Drawing.Point
capture
|
Returns
|
System.Boolean
|
Events
PreviewDragDrop
Declaration
public event EventHandler<RadDropEventArgs> PreviewDragDrop
Event Type
|
System.EventHandler<RadDropEventArgs>
|
PreviewDragHint
Declaration
public event EventHandler<PreviewDragHintEventArgs> PreviewDragHint
Event Type
|
System.EventHandler<PreviewDragHintEventArgs>
|
PreviewDragOver
Declaration
public event EventHandler<RadDragOverEventArgs> PreviewDragOver
Event Type
|
System.EventHandler<RadDragOverEventArgs>
|
PreviewDragStart
Declaration
public event EventHandler<PreviewDragStartEventArgs> PreviewDragStart
Event Type
|
System.EventHandler<PreviewDragStartEventArgs>
|
PreviewDropTarget
Declaration
public event EventHandler<PreviewDropTargetEventArgs> PreviewDropTarget
Event Type
|
System.EventHandler<PreviewDropTargetEventArgs>
|
Explicit Interface Implementations
IMessageListener.DesiredHook
IMessageListener.PreviewMessage(ref Message)
Declaration
MessagePreviewResult IMessageListener.PreviewMessage(ref Message msg)
Parameters
|
System.Windows.Forms.Message
msg
|
Returns
|
MessagePreviewResult
|
Implements
IMessageListener.PreviewSystemMessage(SystemMessage, Message)
Declaration
void IMessageListener.PreviewSystemMessage(SystemMessage message, Message msg)
Parameters
|
SystemMessage
message
|
|
System.Windows.Forms.Message
msg
|
Implements
IMessageListener.PreviewWndProc(Message)
Declaration
void IMessageListener.PreviewWndProc(Message msg)
Parameters
|
System.Windows.Forms.Message
msg
|