Language: EN


How to Drag and Drop in C# with DragDrop Gong

DragDrop.Gong is an open-source library for .NET applications in WPF that greatly facilitates working with Drag and Drop operations.

No matter the language you use, Drag and Drop operations are usually never as simple as they should be. It is common for libraries or frameworks to emerge to simplify the process.

WPF is not only an exception, but by default drag and drop operations are a real nightmare.

DragDrop.Gong comes to solve this problem and has actually become almost a standard. Personally, I wouldn’t even think about wasting time doing Drag and Drop without this library.

With this library, we can create Drag and Drop operations easily, even with really advanced and powerful functions.

Some of its features are,

  • Works with any ItemsControl, such as ListBox, ListView, TreeView, or DataGrid
  • Works with multiple selections
  • Can insert, move, or copy an item in a collection of the same control
  • Allows moving or copying items between different controls, even if the type is different
  • Compatible with MVVM architecture
  • Allows displaying Adorners to give the user a visual preview of the operation

How to use DragDrop.Gong

First, we must add the NuGet package to our project using

Install-Package gong-wpf-dragdrop

Next, we add the namespace


DragDrop.Gong works by adding additional properties and behaviors to our XAML objects.

For example,

<ListBox ItemsSource="{Binding Collection}"

We are saying that our ListBox can initiate Drags and receive Drops.

Of course, we can override the action to be performed when starting or finishing the drop, bind whether the object is ‘dragable’ or ‘dropable’ with a property, define adorners, and any need you may have.

The library has very good documentation, and it includes a very large collection of examples that cover a wide variety of scenarios. I recommend taking a look at them, because some are really interesting.

DragDrop.Gong is Open Source, and all the code and documentation are available on GitHub - punker76/gong-wpf-dragdrop: The GongSolutions.WPF.DragDrop library is a drag’n’drop framework for WPF