New to Telerik UI for WinForms? Start a free 30-day trial

Represents a service that manages drag and drop operations with visual feedback, cursor management, and event handling.

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.

Definition

Namespace:Telerik.WinControls

Assembly:Telerik.WinControls.dll

Syntax:

C#
public class RadDragDropService : RadService, IDisposable, INotifyPropertyChanged, ICustomTypeDescriptor, IMessageListener

Inheritance: objectDisposableObjectRadObjectRadServiceRadDragDropService

Derived Classes: AppointmentDraggingBehaviorDetailListViewDragDropServiceGanttViewDragDropServiceLayoutControlDragDropServiceListControlDragDropServiceListViewDragDropServicePivotFieldListDragDropServicePivotGridDragDropServiceRadGridViewDragDropServiceRadPageViewDragDropServiceRadTabbedFormDragDropServiceRadTaskBoardDragDropServiceTileDragDropServiceTreeViewDragDropService...

Implements: ICustomTypeDescriptorIDisposableIMessageListenerINotifyPropertyChanged

Inherited Members RadService.CanOperate()RadService.Start(object)RadService.Stop(bool)RadService.Pause()RadService.Resume()RadService.OnStarted()RadService.OnStarting(RadServiceStartingEventArgs)RadService.OnStopped()RadService.OnStopping(RadServiceStoppingEventArgs)RadService.IsContextValid(object)RadService.Abort()RadService.PerformResume()RadService.PerformPause()RadService.SetContext(object)RadService.OnEnabledChanged()RadService.ContextRadService.AvailableAtDesignTimeRadService.StateRadService.NameRadService.EnabledRadService.StartingRadService.StartedRadService.StoppingRadService.StoppedRadObject.BindingContextPropertyRadObject.RadTypeRadObject.ReplaceDefaultDescriptors(PropertyDescriptorCollection)RadObject.ClearPropertyStore()RadObject.SuspendPropertyNotifications()RadObject.ResumePropertyNotifications()RadObject.GetPropertyValue(RadProperty)RadObject.SetDefaultValueOverride(RadProperty, object)RadObject.GetValue(RadProperty)RadObject.SetValue(RadProperty, object)RadObject.ResetValue(RadProperty)RadObject.ResetLocalValue(RadProperty)RadObject.ResetValue(RadProperty, ValueResetFlags)RadObject.UpdateValue(RadProperty)RadObject.GetValueSource(RadProperty)RadObject.GetRegisteredRadProperty(string)RadObject.UpdateValueCore(RadPropertyValue)RadObject.SetValueCore(RadPropertyValue, object, object, ValueSource)RadObject.ResetValueCore(RadPropertyValue, ValueResetFlags)RadObject.GetDefaultValue(RadPropertyValue, object)RadObject.CoerceValue(RadPropertyValue, object)RadObject.ShouldSerializeProperty(RadProperty)RadObject.CanRaisePropertyChangeNotifications(RadPropertyValue)RadObject.BindProperty(RadProperty, RadObject, RadProperty, PropertyBindingOptions)RadObject.UnbindProperty(RadProperty)RadObject.AddStylePropertySetting(IPropertySetting)RadObject.GetInheritedValue(RadProperty)RadObject.OnPropertyChanging(RadPropertyChangingEventArgs)RadObject.OnPropertyChanged(RadPropertyChangedEventArgs)RadObject.OnNotifyPropertyChanged(string)RadObject.OnNotifyPropertyChanged(PropertyChangedEventArgs)RadObject.OnShouldSerializeProperty(ShouldSerializePropertyEventArgs)RadObject.IsPropertyCancelable(RadPropertyMetadata)RadObject.PropertyValuesRadObject.PropertyFilterRadObject.RadObjectTypeRadObject.BindingContextRadObject.PropertyChangedRadObject.RadPropertyChangedRadObject.RadPropertyChangingDisposableObject.GetBitState(long)DisposableObject.SetBitState(long, bool)DisposableObject.OnBitStateChanged(long, bool, bool)DisposableObject.Dispose()DisposableObject.Dispose(bool)DisposableObject.PerformDispose(bool)DisposableObject.DisposeUnmanagedResources()DisposableObject.BitStateDisposableObject.EventsDisposableObject.IsDisposingDisposableObject.IsDisposedDisposableObject.DisposedDisposableObject.Disposing...

Constructors

Initializes a new instance of the RadDragDropService class.

C#
public RadDragDropService()

Sets up default cursors, hint window configuration, and initializes the service with default drag and drop behavior settings.

Fields

C#
protected Point? beginPoint
C#
protected bool messageFilterAdded
C#
protected int xOutlineFormOffset
C#
protected int yOutlineFormOffset

Properties

Determines whether a drop operation will be committed (a valid drop target is found).

C#
protected bool CanCommit { get; }

Gets the current drop location in the context of the current target.

C#
public Point DropLocation { get; }

Gets current drop target, where the mouse cursor points.

C#
public ISupportDrop DropTarget { get; }

Gets the Hint window.

C#
protected RadLayeredWindow HintWindow { get; }
Property Value:

The hint window.

C#
protected bool Initialized { get; }

Gets or sets the cursor to be used when a valid drop target is hit-tested.

C#
public Cursor InvalidCursor { get; set; }

Determines whether a default preview is generated for a ISupportDrag instance if its GetPreview method returns null.

C#
public bool UseDefaultPreview { get; set; }

Gets or sets the cursor to be used when a valid drop target is hit-tested.

C#
public Cursor ValidCursor { get; set; }

Methods

Begins a drag pass. Allows for service automation.

C#
public void BeginDrag(Point mouseBeginPoint, ISupportDrag draggedObject)
Parameters:mouseBeginPointPoint

The position of the mouse cursor in screen coordinates.

draggedObjectISupportDrag

An instance of IDraggable that is dragged.

Determines whether the service may be started. Validation is as follows:

  1. Check whether Enabled is true.
  2. Check the context through IsContextValid method. An exception is thrown if context is invalid.
  3. Checks the current state - it should be Initial or Stopped.
C#
protected override bool CanStart(object context)
Parameters:contextobjectReturns:

bool

Overrides: RadService.CanStart(object)

Ends the current operation and applies all changes.

C#
protected override void Commit()

Overrides: RadService.Commit()

Releases managed resources by clearing the property store and disposing value animators to prevent memory leaks.

C#
protected override void DisposeManagedResources()

Overrides: RadObject.DisposeManagedResources()

Mocks a mouse move to a specific point. Allows for service automation.

C#
public void DoMouseMove(Point mousePos)
Parameters:mousePosPoint

Ends a drag pass. Allows for service automation.

C#
public void EndDrag()

Ends a drag pass. Allows for service automation.

C#
public void EndDrag(Point mouseEndPoint, RadControl targetControl)
Parameters:mouseEndPointPoint

The end position of the mouse cursor in screen coordinates.

targetControlRadControl

An instance of RadControl.

C#
protected virtual ISupportDrop GetDropTarget(Point mousePosition, out Point resultDropLocation)
Parameters:mousePositionPointresultDropLocationPointReturns:

ISupportDrop

C#
protected virtual void HandleEscKeyDown()
C#
protected virtual void HandleLeftButtonUp()
C#
protected virtual void HandleMouseMove(Point mousePos)
Parameters:mousePosPoint
C#
protected virtual bool IsDropTargetValid(ISupportDrop dropTarget)
Parameters:dropTargetISupportDropReturns:

bool

C#
protected virtual void OnPreviewDragDrop(RadDropEventArgs e)
Parameters:eRadDropEventArgs
C#
protected virtual void OnPreviewDragHint(PreviewDragHintEventArgs e)
Parameters:ePreviewDragHintEventArgs
C#
protected virtual void OnPreviewDragOver(RadDragOverEventArgs e)
Parameters:eRadDragOverEventArgs
C#
protected virtual void OnPreviewDragStart(PreviewDragStartEventArgs e)
Parameters:ePreviewDragStartEventArgs
C#
protected virtual void OnPreviewDropTarget(PreviewDropTargetEventArgs e)
Parameters:ePreviewDropTargetEventArgs

Performs the core Start logic.

C#
protected override void PerformStart()

Overrides: RadService.PerformStart()

Stops the service. Performs the core logic.

C#
protected override void PerformStop()

Overrides: RadService.PerformStop()

C#
protected virtual bool PrepareContext()
Returns:

bool

C#
protected virtual void RestoreOriginalMouseCursor()
C#
protected virtual void SetHintWindowPosition(Point mousePt)
Parameters:mousePtPoint
C#
public static bool ShouldBeginDrag(Point current, Point capture)
Parameters:currentPointcapturePointReturns:

bool

Events

C#
public event EventHandler<RadDropEventArgs> PreviewDragDrop
C#
public event EventHandler<PreviewDragHintEventArgs> PreviewDragHint
C#
public event EventHandler<RadDragOverEventArgs> PreviewDragOver
C#
public event EventHandler<PreviewDragStartEventArgs> PreviewDragStart
C#
public event EventHandler<PreviewDropTargetEventArgs> PreviewDropTarget