ComponentOne Basic Library for WPF and Silverlight
RegisterDragSource Method (C1DragDropManager)


C1.WPF Namespace > C1DragDropManager Class : RegisterDragSource Method
System.Windows.UIElement that will act as a drag source.
DragDropEffect that will be supported by the source object.
System.Windows.Input.ModifierKeys that should be pressed in order for the drag operation to start.
Registers a System.Windows.UIElement to act as a drag source.
Syntax
'Declaration
 
Public Sub RegisterDragSource( _
   ByVal source As System.Windows.UIElement, _
   ByVal effect As DragDropEffect, _
   ByVal keys As System.Windows.Input.ModifierKeys, _
   Optional ByVal handledEventsToo As System.Boolean _
) 
'Usage
 
Dim instance As C1DragDropManager
Dim source As System.Windows.UIElement
Dim effect As DragDropEffect
Dim keys As System.Windows.Input.ModifierKeys
Dim handledEventsToo As System.Boolean
 
instance.RegisterDragSource(source, effect, keys, handledEventsToo)
public void RegisterDragSource( 
   System.Windows.UIElement source,
   DragDropEffect effect,
   System.Windows.Input.ModifierKeys keys,
   System.bool handledEventsToo
)

Parameters

source
System.Windows.UIElement that will act as a drag source.
effect
DragDropEffect that will be supported by the source object.
keys
System.Windows.Input.ModifierKeys that should be pressed in order for the drag operation to start.
handledEventsToo
Remarks

When a System.Windows.UIElement is registered as a drag source, the C1DragDropManager monitors the mouse events for that element and starts drag-drop operations automatically when the user presses the mouse over the element and moves it for a few pixels.

This is a convenience method, it is not strictly required; you could handle the mouse events for the objects you want to use as drag sources and call the DoDragDrop method explicitly.

To un-register an element as a drag source, call the RegisterDragSource method passing the element and DragDropEffect.None.

Note that only elements that raise mouse events may be used as automatic drag sources. For example, the System.Windows.Controls.Button and System.Windows.Controls.TextBox controls consume mouse events internally, so the C1DragDropManager does not receive any mouse events for these controls. Therefore, they cannot be used as automatic drag sources.

See Also

Reference

C1DragDropManager Class
C1DragDropManager Members