Defines the basic methods of a generic DragDropBehavior.
Definition
Namespace:Telerik.Windows.DragDrop.Behaviors
Assembly:Telerik.Windows.Controls.dll
Type Parameters:
TState
The state type.
Syntax:
public abstract class DragDropBehavior<TState> : DependencyObject, IDragDropBehavior<TState> where TState : DragDropState
Inheritance: objectDragDropBehavior<TState>
Derived Classes:
Implements:
Constructors
Initializes a new instance of the DragDropBehavior<TState> class.
protected DragDropBehavior()
Fields
ItemTypeProperty
DependencyProperty
Identifies the ItemType dependency property.
public static readonly DependencyProperty ItemTypeProperty
Properties
Gets or sets the value specifying whether the ListBoxDragDropBehavior can reorder items or not.
public bool AllowReorder { get; set; }
Methods
Returns a value specifying whether the current drag operation can be completed.
public virtual bool CanDrop(TState state)
DragDropState that provides context for the current operation.
Returns:True if the drag operation can be completed, otherwise false.
Implements:
This method is called only in the context of the drop target control.
Returns a value specifying whether the drag operation can be started.
public virtual bool CanStartDrag(TState state)
DragDropState that provides context for the current operation.
Returns:True if the drag operation can be completed, otherwise false.
Implements:
This method is called only in the context of the drag source control.
When overridden in a derived class, filters the dragged items collection if necessary.
public virtual IEnumerable CoerceDraggedItems(TState state)
DragDropState that provides context for the current operation.
Returns:The filtered dragged items.
Implements:
This method is called immediately before the drag operation starts. Only the Items property of the DragDropState is valid.
Copies the items that are dragged in the operation specified by the provided ListBoxDragDropState.
protected virtual IEnumerable<object> CopyDraggedItems(TState state)
When overridden in a derived class cleans up a cancelled drag operation. This method is called only in the context of the drag source control.
public virtual void DragDropCanceled(TState state)
DragDropState that provides context for the current operation.
Implements:
This method is called only when the drag operation is cancelled by the user. If this method is called, the source's DragDropCompleted and target's Drop methods are not called.
When overridden in a derived class completes the drag operation. This method is called only in the context of the drag source control.
public virtual void DragDropCompleted(TState state)
DragDropState that provides context for the current operation.
Implements:
When the drag source and the drop target are the same control, this method is called after Drop. This method is called only when the drag operation completed successfully. If this method is called, DragDropCanceled is not called.
Completes the drop operation. This method is called only in the context of the drop target control.
public virtual void Drop(TState state)
DragDropState that provides context for the current operation.
Implements:
When the drag source and the drop target are the same control, this method is called before DragCompleted.
GetDragDropEffects(TState)
DragDropEffects
Returns the DragDropEffects for the current drag drop operation. The return value affects the mouse cursor.
public virtual DragDropEffects GetDragDropEffects(TState state)
DragDropState that provides context for the current operation.
Returns:DragDropEffects
This method is called only in the context of the drop target control.
Helper method that inserts the specified items in the source list, at the specified index. If index==-1, adds the items at the end of the list.
protected static void InsertItems(IList source, int index, IEnumerable items)
Returns true if the dragged items should be removed from the source list, otherwise false.
protected virtual bool IsMovingItems(TState state)
DragDropState that provides context for the current operation.
Returns:Helper method that removes the specified items from the source list.
protected static void RemoveItems(IList source, IEnumerable items)