Class DragDropHelper<TBehavior, TState>
Binds the DragDropManager events with a DragDropBehavior.
Inheritance
Namespace: Telerik.Windows.DragDrop.Behaviors
Assembly: Telerik.Windows.Controls.dll
Syntax
public abstract class DragDropHelper<TBehavior, TState> : Object where TBehavior : DragDropBehavior<TState> where TState : DragDropState, new()
Type Parameters
TBehavior
|
TState
|
Constructors
DragDropHelper()
Declaration
protected DragDropHelper()
Properties
DataConverter
Gets or sets the IDataObjectProvider instance that will be used in the drag-drop operations.
Declaration
public DataConverter DataConverter { get; set; }
Property Value
DataConverter
|
DragDropBehavior
Gets or sets the DragDropBehavior that will be used in the drag-drop operations.
Declaration
public TBehavior DragDropBehavior { get; set; }
Property Value
TBehavior
|
DragVisualProvider
Gets or sets the DragVisualProvider that will be used in the drag-drop operations.
Declaration
public IDragVisualProvider DragVisualProvider { get; set; }
Property Value
IDragVisualProvider
|
Methods
CreateDragVisualProviderState(Point, FrameworkElement, TState)
Creates and initializes a DragVisualProviderState object.
Declaration
protected virtual DragVisualProviderState CreateDragVisualProviderState(Point relativeStartPoint, FrameworkElement control, TState state)
Parameters
System.Windows.Point
relativeStartPoint
|
System.Windows.FrameworkElement
control
|
TState
state
|
Returns
DragVisualProviderState
|
CreateStateForDrop(FrameworkElement, FrameworkElement, Object, Type)
Creates and initializes a DragDropState from the provided DragEventArgs.
Declaration
protected virtual TState CreateStateForDrop(FrameworkElement dropTarget, FrameworkElement dropItemsControl, object data, Type itemType)
Parameters
System.Windows.FrameworkElement
dropTarget
|
System.Windows.FrameworkElement
dropItemsControl
|
System.Object
data
|
System.Type
itemType
|
Returns
TState
|
DragDropCompleted(FrameworkElement, Object, Type, Boolean)
When overridden in a derived class allows calling custom code on the DragDropCompleted event.
Declaration
protected virtual void DragDropCompleted(FrameworkElement dropItemsControl, object data, Type itemType, bool wasCanceled)
Parameters
System.Windows.FrameworkElement
dropItemsControl
|
System.Object
data
|
System.Type
itemType
|
System.Boolean
wasCanceled
|
DragLeave(FrameworkElement, FrameworkElement, Object, Type)
When overridden in a derived class allows calling custom code on the MouseLeave event.
Declaration
protected virtual void DragLeave(FrameworkElement dropTarget, FrameworkElement dropItemsControl, object data, Type itemType)
Parameters
System.Windows.FrameworkElement
dropTarget
The object that is being dropped. |
System.Windows.FrameworkElement
dropItemsControl
The destination ItemsControl. |
System.Object
data
The drag and drop data. |
System.Type
itemType
The data type of the dragged item. |
DragOver(FrameworkElement, FrameworkElement, Object, Type)
When overridden in a derived class allows calling custom code on the DragOver event.
Declaration
protected virtual DragDropEffects DragOver(FrameworkElement dropTarget, FrameworkElement dropItemsControl, object data, Type itemType)
Parameters
System.Windows.FrameworkElement
dropTarget
|
System.Windows.FrameworkElement
dropItemsControl
|
System.Object
data
|
System.Type
itemType
|
Returns
System.Windows.DragDropEffects
|
Drop(FrameworkElement, FrameworkElement, Object, Type)
When overridden in a derived class allows custom code in the Drop event.
Declaration
protected virtual void Drop(FrameworkElement dropTarget, FrameworkElement dropItemsControl, object data, Type itemType)
Parameters
System.Windows.FrameworkElement
dropTarget
|
System.Windows.FrameworkElement
dropItemsControl
|
System.Object
data
|
System.Type
itemType
|
FindDraggedItem(FrameworkElement)
Finds the control that contains the provided element. In case of a ListBox drag-drop implementation, this method should return the ListBoxItem that is going to be dragged.
Declaration
protected abstract FrameworkElement FindDraggedItem(FrameworkElement element)
Parameters
System.Windows.FrameworkElement
element
The element that raised the DragInitialize event. |
Returns
System.Windows.FrameworkElement
|
FindDragSource(FrameworkElement)
Finds the control that contains the provided element. In case of a ListBox drag-drop implementation, this method should return a ListBox.
Declaration
protected abstract FrameworkElement FindDragSource(FrameworkElement element)
Parameters
System.Windows.FrameworkElement
element
The element that raised the DragInitialize event. |
Returns
System.Windows.FrameworkElement
|
FindDropItemsControl(FrameworkElement, Object)
Finds the target control that should accept the dragged items. In case of a ListBox drag-drop implementation, this method should return a ListBox.
Declaration
protected abstract FrameworkElement FindDropItemsControl(FrameworkElement element, object data)
Parameters
System.Windows.FrameworkElement
element
The element that raised the Drop event. |
System.Object
data
The DataObject for the current drag operation. |
Returns
System.Windows.FrameworkElement
|
FindDropTarget(FrameworkElement)
Finds an item from the target control that contains the provided element. In case of a ListBox drag-drop implementation, this method should return a ListBoxItem.
Declaration
protected abstract FrameworkElement FindDropTarget(FrameworkElement element)
Parameters
System.Windows.FrameworkElement
element
The element that raised the Drop event. |
Returns
System.Windows.FrameworkElement
|
GetContainerFromItem(FrameworkElement, Object)
Returns the container for the specified item. When overridden in a derived class allows usage of custom ItemContainerGenerators.
Declaration
protected virtual DependencyObject GetContainerFromItem(FrameworkElement control, object item)
Parameters
System.Windows.FrameworkElement
control
|
System.Object
item
|
Returns
System.Windows.DependencyObject
|
GetDraggedItems(FrameworkElement)
When overridden in a derived class this method returns the items that should be dragged.
Declaration
protected abstract IEnumerable<object> GetDraggedItems(FrameworkElement draggedItem)
Parameters
System.Windows.FrameworkElement
draggedItem
The source control of the drag operation. |
Returns
System.Collections.Generic.IEnumerable<System.Object>
The items that should be dragged. |
GetInferredItemType(IEnumerable)
Returns the type of the items in the provided collection.
Declaration
protected static Type GetInferredItemType(IEnumerable itemsSource)
Parameters
System.Collections.IEnumerable
itemsSource
|
Returns
System.Type
|
GetItemsFromDataObject(Object, Type)
Retrieves items from the specified data object only of the specified type.
Declaration
protected IEnumerable GetItemsFromDataObject(object data, Type itemType)
Parameters
System.Object
data
|
System.Type
itemType
|
Returns
System.Collections.IEnumerable
|
GetItemsOfType(IEnumerable, Type)
Returns IEnumerable containing only items from the provided Type.
Declaration
protected static IEnumerable GetItemsOfType(IEnumerable enumerable, Type itemType)
Parameters
System.Collections.IEnumerable
enumerable
|
System.Type
itemType
|
Returns
System.Collections.IEnumerable
|
GetItemsSource(FrameworkElement)
Returns a list containing the items of the specified control.
Declaration
protected virtual IList GetItemsSource(FrameworkElement element)
Parameters
System.Windows.FrameworkElement
element
|
Returns
System.Collections.IList
|
GetItemType(FrameworkElement)
Returns the Type of the items in the provided control.
Declaration
protected Type GetItemType(FrameworkElement control)
Parameters
System.Windows.FrameworkElement
control
|
Returns
System.Type
|