Class
DragDropBehavior<TState>

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:

cs-api-definition
public abstract class DragDropBehavior<TState> : DependencyObject, IDragDropBehavior<TState> where TState : DragDropState

Inheritance: objectDragDropBehavior<TState>

Derived Classes: TaskBoardColumnDragDropBehaviorGridViewDragDropBehaviorListBoxDragDropBehavior

Implements: IDragDropBehavior<TState>

Constructors

DragDropBehavior()

Initializes a new instance of the DragDropBehavior<TState> class.

Declaration

cs-api-definition
protected DragDropBehavior()

Fields

ItemTypeProperty

Identifies the ItemType dependency property.

Declaration

cs-api-definition
[SuppressMessage("Microsoft.Design", "CA1000:DoNotDeclareStaticMembersOnGenericTypes")]
public static readonly DependencyProperty ItemTypeProperty

Field Value

DependencyProperty

Properties

AllowReorder

Gets or sets the value specifying whether the ListBoxDragDropBehavior can reorder items or not.

Declaration

cs-api-definition
public bool AllowReorder { get; set; }

Property Value

bool

ItemType

Gets or sets the Type of the items that can be accepted by the host control. This is a dependency property.

Declaration

cs-api-definition
public Type ItemType { get; set; }

Property Value

Type

Methods

CanDrop(TState)

Returns a value specifying whether the current drag operation can be completed.

Declaration

cs-api-definition
public virtual bool CanDrop(TState state)

Parameters

state

TState

DragDropState that provides context for the current operation.

Returns

bool

True if the drag operation can be completed, otherwise false.

Implements IDragDropBehavior<TState>.CanDrop(TState)

Remarks

This method is called only in the context of the drop target control.

CanStartDrag(TState)

Returns a value specifying whether the drag operation can be started.

Declaration

cs-api-definition
public virtual bool CanStartDrag(TState state)

Parameters

state

TState

DragDropState that provides context for the current operation.

Returns

bool

True if the drag operation can be completed, otherwise false.

Implements IDragDropBehavior<TState>.CanStartDrag(TState)

Remarks

This method is called only in the context of the drag source control.

CoerceDraggedItems(TState)

When overridden in a derived class, filters the dragged items collection if necessary.

Declaration

cs-api-definition
public virtual IEnumerable CoerceDraggedItems(TState state)

Parameters

state

TState

DragDropState that provides context for the current operation.

Returns

IEnumerable

The filtered dragged items.

Implements IDragDropBehavior<TState>.CoerceDraggedItems(TState)

Remarks

This method is called immediately before the drag operation starts. Only the Items property of the DragDropState is valid.

CopyDraggedItems(TState)

Copies the items that are dragged in the operation specified by the provided ListBoxDragDropState.

Declaration

cs-api-definition
protected virtual IEnumerable<object> CopyDraggedItems(TState state)

Parameters

state

TState

Returns

IEnumerable<object>

DragDropCanceled(TState)

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.

Declaration

cs-api-definition
public virtual void DragDropCanceled(TState state)

Parameters

state

TState

DragDropState that provides context for the current operation.

Implements IDragDropBehavior<TState>.DragDropCanceled(TState)

Remarks

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.

DragDropCompleted(TState)

When overridden in a derived class completes the drag operation. This method is called only in the context of the drag source control.

Declaration

cs-api-definition
public virtual void DragDropCompleted(TState state)

Parameters

state

TState

DragDropState that provides context for the current operation.

Implements IDragDropBehavior<TState>.DragDropCompleted(TState)

Remarks

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.

Drop(TState)

Completes the drop operation. This method is called only in the context of the drop target control.

Declaration

cs-api-definition
public virtual void Drop(TState state)

Parameters

state

TState

DragDropState that provides context for the current operation.

Implements IDragDropBehavior<TState>.Drop(TState)

Remarks

When the drag source and the drop target are the same control, this method is called before DragCompleted.

GetDragDropEffects(TState)

Returns the DragDropEffects for the current drag drop operation. The return value affects the mouse cursor.

Declaration

cs-api-definition
public virtual DragDropEffects GetDragDropEffects(TState state)

Parameters

state

TState

DragDropState that provides context for the current operation.

Returns

DragDropEffects

Remarks

This method is called only in the context of the drop target control.

InsertItems(IList, int, IEnumerable)

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.

Declaration

cs-api-definition
protected static void InsertItems(IList source, int index, IEnumerable items)

Parameters

source

IList

index

int

items

IEnumerable

IsMovingItems(TState)

Returns true if the dragged items should be removed from the source list, otherwise false.

Declaration

cs-api-definition
protected virtual bool IsMovingItems(TState state)

Parameters

state

TState

DragDropState that provides context for the current operation.

Returns

bool

RemoveItems(IList, IEnumerable)

Helper method that removes the specified items from the source list.

Declaration

cs-api-definition
protected static void RemoveItems(IList source, IEnumerable items)

Parameters

source

IList

items

IEnumerable