Drag and Drop from another control
RadListView supports drag and drop functionality from another control, such as dragging and dropping items from a Microsoft ListBox. It is necessary to set the AllowDrop property to true for both of the controls.
Drag and drop from ListBox to RadListView
Figure 1 Drag and drop from ListBox to RadListView
1. Firstly, we should start the drag and drop operation, using the ListBox.MouseMove event when the left mouse button is pressed. We should keep the mouse down location in the ListBox.MouseDown event. Afterwards, allow dragging over the RadListView via the Effect argument of the DragEventArgs in the RadListView.DragEnter event handler:
Starting a drag and drop operation
2. In the RadListView.DragDrop event handler you need to get the location of the mouse and convert it to a point that RadListView can use to get the target item underneath the mouse. Afterwards, insert the dragged item at the specific position in the RadListView.Items collection and remove it from the ListBox. We should reset the stored mouse down location as well.
Handling drop operation
Drag and drop from RadListView to ListBox
Figure 2: Drag and drop from RadListView to ListBox
1. In order to enable dragging an item from the RadListView and dropping it onto the ListBox, it is necessary to use the RadListView.MouseDown and the RadListView.MouseMove events to start the drag and drop operation. In the ListBox.DragOver event you should allow the drop operation:
Starting a drag and drop operation
2. Finally, perform the exact drag and drop operation via inserting a new item in the ListBox in the DragDrop event. We should reset the stored mouse down location as well: