DualList Drag & Drop Component

By Fons Sonnemans, posted on

I have written an article two years ago with the title 'WinForm DualList Component'. In this article I mentioned the desire to extend the DualList component with Drag & Drop support. Finally it's done. Not by extending the original DualList component but by creating an new DualListDragDrop component (reason: cohesion).

Programming Drag & Drop (D&D) between listboxes is quite difficult. It requires at least 60 lines of code for every two listboxes. Therefore not many application support D&D. This component eliminates need of writing the code. You only have to set properties on it. Making it easy to support D&D in your applications.

DualListDragDrop Component

The DualListDragDrop component is a component which can be dropped in the 'component tray' of a windows Form. You therefore first have to add it to the Toolbox of Visual Studio.NET. This can easily be done by dragging   ReflectionITWinFormComponents.dll assembly from an normal Windows Explorer and dropping it on the Toolbox. All controls and components from the assembly will be added to the Toolbox. You can create an separate Tab for it if you want.

For each D&D direction you must add DualListDragDrop component to you Form. In this example three. For each component you have to set the '(Name)', 'ListBoxFrom' and 'ListBoxTo' properties.


You can use the DualListDragDrop component to reorder the position of the items in a ListBox by selecting the same 'From' and 'To' ListBox.

Action property

You can choose from three values for the Action property: Move, Copy and MoveAndCopy. The MoveAndCopy will normally move an item. You can copy the item by pressing the Ctrlkey while initiating the D&D operation.

DropIndicator property

The DropIndicator can be set to 'True' which means you will get a red dotted line indicating where the item will be placed when you drop the item. It supports scrolling the listbox up and down when you move your mouse over the first or last visible item. The item will be added to the bottom of the list when the property is set to 'False'. The color of the line can be selected using the IndicatorColor property.


The DualList and DualListDragDrop components are easy solutions for difficult features. It takes care of all logic needed to move and or copy items from one listbox to another. Use them in your own applications, they are free.

Hopefully this article will encourage more people to make use of the component architecture in their own applications.

Any suggestions and feedback for improving this article is most welcome. Send your suggestions and feedback to Fons.Sonnemans@reflectionit.nl

License Information

The ReflectionITWinFormComponents assembly is free for use in commercial or private applications. However, you may only redistribute this in its compiled form (modified or unmodified), you may not redistribute the source or modified source. When using it, please include the line "ReflectionITWinFormComponents - Copyright Reflection IT - https://www.reflectionit.nl/" reference in either the about or in the documentation. This will help me out and allow me to continue to provide you with free controls.


All postings/content on this blog are provided "AS IS" with no warranties, and confer no rights. All entries in this blog are my opinion and don't necessarily reflect the opinion of my employer or sponsors. The content on this site is licensed under a Creative Commons Attribution By license.

Leave a comment

Blog comments

0 responses