Class DragDropBehavior<TState>
Defines the basic methods of a generic DragDropBehavior.
Inheritance
Namespace: Telerik.Windows.DragDrop.Behaviors
Assembly: Telerik.Windows.Controls.dll
Syntax
public abstract class DragDropBehavior<TState> : DependencyObject, IDragDropBehavior<TState> where TState : DragDropState
Type Parameters
TState
The state type. |
Constructors
DragDropBehavior()
Initializes a new instance of the DragDropBehavior<TState> class.
Declaration
protected DragDropBehavior()
Fields
ItemTypeProperty
Identifies the ItemType dependency property.
Declaration
public static readonly DependencyProperty ItemTypeProperty
Field Value
System.Windows.DependencyProperty
|
Properties
AllowReorder
Gets or sets the value specifying whether the ListBoxDragDropBehavior can reorder items or not.
Declaration
public bool AllowReorder { get; set; }
Property Value
System.Boolean
|
ItemType
Gets or sets the Type of the items that can be accepted by the host control. This is a dependency property.
Declaration
public Type ItemType { get; set; }
Property Value
System.Type
|
Methods
CanDrop(TState)
Returns a value specifying whether the current drag operation can be completed.
Declaration
public virtual bool CanDrop(TState state)
Parameters
TState
state
DragDropState that provides context for the current operation. |
Returns
System.Boolean
True if the drag operation can be completed, otherwise false. |
Implements
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
public virtual bool CanStartDrag(TState state)
Parameters
TState
state
DragDropState that provides context for the current operation. |
Returns
System.Boolean
True if the drag operation can be completed, otherwise false. |
Implements
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
public virtual IEnumerable CoerceDraggedItems(TState state)
Parameters
TState
state
DragDropState that provides context for the current operation. |
Returns
System.Collections.IEnumerable
The filtered dragged items. |
Implements
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
protected virtual IEnumerable<object> CopyDraggedItems(TState state)
Parameters
TState
state
|
Returns
System.Collections.Generic.IEnumerable<System.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
public virtual void DragDropCanceled(TState state)
Parameters
TState
state
DragDropState that provides context for the current operation. |
Implements
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
public virtual void DragDropCompleted(TState state)
Parameters
TState
state
DragDropState that provides context for the current operation. |
Implements
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
public virtual void Drop(TState state)
Parameters
TState
state
DragDropState that provides context for the current operation. |
Implements
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
public virtual DragDropEffects GetDragDropEffects(TState state)
Parameters
TState
state
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, Int32, 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
protected static void InsertItems(IList source, int index, IEnumerable items)
Parameters
System.Collections.IList
source
|
System.Int32
index
|
System.Collections.IEnumerable
items
|
IsMovingItems(TState)
Returns true if the dragged items should be removed from the source list, otherwise false.
Declaration
protected virtual bool IsMovingItems(TState state)
Parameters
TState
state
DragDropState that provides context for the current operation. |
Returns
System.Boolean
|
RemoveItems(IList, IEnumerable)
Helper method that removes the specified items from the source list.
Declaration
protected static void RemoveItems(IList source, IEnumerable items)
Parameters
System.Collections.IList
source
|
System.Collections.IEnumerable
items
|