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

Handles dragging and reordering list-view items, including transfers between list views.

Definition

Namespace:Telerik.WinControls.UI

Assembly:Telerik.WinControls.UI.dll

Syntax:

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

Inheritance: objectDisposableObjectRadObjectRadServiceRadDragDropServiceListViewDragDropService...

Implements: ICustomTypeDescriptorIDisposableIMessageListenerINotifyPropertyChanged

Inherited Members RadDragDropService.messageFilterAddedRadDragDropService.xOutlineFormOffsetRadDragDropService.yOutlineFormOffsetRadDragDropService.beginPointRadDragDropService.DisposeManagedResources()RadDragDropService.HandleLeftButtonUp()RadDragDropService.HandleEscKeyDown()RadDragDropService.PrepareContext()RadDragDropService.OnPreviewDragHint(PreviewDragHintEventArgs)RadDragDropService.RestoreOriginalMouseCursor()RadDragDropService.SetHintWindowPosition(Point)RadDragDropService.ShouldBeginDrag(Point, Point)RadDragDropService.OnPreviewDragStart(PreviewDragStartEventArgs)RadDragDropService.Commit()RadDragDropService.GetDropTarget(Point, out Point)RadDragDropService.OnPreviewDropTarget(PreviewDropTargetEventArgs)RadDragDropService.BeginDrag(Point, ISupportDrag)RadDragDropService.EndDrag(Point, RadControl)RadDragDropService.EndDrag()RadDragDropService.DoMouseMove(Point)RadDragDropService.CanCommitRadDragDropService.ValidCursorRadDragDropService.InitializedRadDragDropService.InvalidCursorRadDragDropService.UseDefaultPreviewRadDragDropService.DropTargetRadDragDropService.DropLocationRadDragDropService.HintWindowRadDragDropService.PreviewDragDropRadDragDropService.PreviewDragOverRadDragDropService.PreviewDropTargetRadDragDropService.PreviewDragStartRadDragDropService.PreviewDragHintRadService.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 the drag-drop service for a list-view element.

C#
public ListViewDragDropService(RadListViewElement owner)
Parameters:ownerRadListViewElement

The list-view element whose items are dragged.

Properties

Gets the item used to start the current drag operation.

C#
public ListViewDataItem DraggedItem { get; }

Gets the selected items included in the current multi-item drag, or null when a single item is dragged.

C#
public List<ListViewDataItem> DraggedItems { get; }

Gets the list-view element that owns this service.

C#
public RadListViewElement Owner { get; }

Methods

Determines whether dragging can start for the context and current list-view settings.

C#
protected override bool CanStart(object context)
Parameters:contextobject

The element that initiated the drag.

Returns:

bool

true when the element is enabled and item dragging is allowed.

Overrides: RadDragDropService.CanStart(object)

Disposes the layered drag-hint window, if one exists.

C#
protected virtual void DisposeDragHint()

Gets the size required by the owning view's drag hint.

C#
protected virtual Size GetDragHintSize(ISupportDrop dropTarget)
Parameters:dropTargetISupportDrop

The current drop target.

Returns:

Size

The drag-hint size in pixels.

Reorders the dragged item or items within the owning list view.

C#
protected virtual void HandleDragDrop(RadDropEventArgs e)
Parameters:eRadDropEventArgs

The drop data used to determine the target item and insertion position.

Transfers the dragged item or items to another list view.

C#
protected virtual void HandleDropBetweenListViews(RadDropEventArgs e)
Parameters:eRadDropEventArgs

The drop data used to determine the target item and insertion position.

Updates the drag hint and scrolls the list when the pointer moves beyond its viewport.

C#
protected override void HandleMouseMove(Point mousePos)
Parameters:mousePosPoint

The pointer position in screen coordinates.

Overrides: RadDragDropService.HandleMouseMove(Point)

Rejects the dragged item as its own drop target and accepts list-view elements as targets.

C#
protected override bool IsDropTargetValid(ISupportDrop dropTarget)
Parameters:dropTargetISupportDrop

The proposed drop target.

Returns:

bool

true if the target is valid; otherwise, false.

Overrides: RadDragDropService.IsDropTargetValid(ISupportDrop)

Runs the built-in item move or transfer when the drop has not been handled by application code.

C#
protected override void OnPreviewDragDrop(RadDropEventArgs e)
Parameters:eRadDropEventArgs

The drop event data.

Overrides: RadDragDropService.OnPreviewDragDrop(RadDropEventArgs)

Built-in movement is skipped for data-bound lists. Grouped or sorted lists display a warning; handle PreviewDragDrop and mark the event handled to supply custom behavior.

Releases the drag hint when the preview target rejects the drop.

C#
protected override void OnPreviewDragOver(RadDragOverEventArgs e)
Parameters:eRadDragOverEventArgs

The drag-over event data.

Overrides: RadDragDropService.OnPreviewDragOver(RadDragOverEventArgs)

Captures the dragged item, collects selected items for a multi-item drag, and prepares the drag hint.

C#
protected override void PerformStart()

Overrides: RadDragDropService.PerformStart()

Clears the current drag items and releases the drag-hint window.

C#
protected override void PerformStop()

Overrides: RadDragDropService.PerformStop()

Creates the layered window used to display the view's drag hint.

C#
protected virtual void PrepareDragHint()

Positions or hides the visual hint for the current drop target.

C#
protected virtual void UpdateDragHintLocation(Point mousePosition)
Parameters:mousePositionPoint

The pointer position in screen coordinates.