Click here to Skip to main content
15,900,818 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Involves using Gong DragDrop WPF NuGet.

Setup:

1. A PreviewDrop event that handles a ListBox.
2. A DataObject variable.
3. Assign e.Data to DataObject variable
4. Drag and Drop object from any place to this ListBox in order to trigger.

What I need to get:

The Content of the ListBoxItem or the Header of the TreeViewItem that was dragged into it (Gong lets you do this) OR the whole object that was dropped in my ListBox.

I can physically see that this DataObject contains this object in its Non-Public Members -> InnerData -> Non-Public Members -> Data -> Raw View -> Values -> Results View -> (0) -> (0) -> Data but I do not know how to access it.

What I have tried:

Googled overflow and codeproject, VB.Net documentation, found nothing specific on the issue (or maybe it was too vague).
Posted
Updated 3-Jan-22 3:43am
v2

1 solution

The solution is much simpler than I thought.

You need to get the DataObject.GetFormats to know what you are working with, copy the string that GetFormats returns, something like this:

Dim myElement = myData.GetFormats

Pass that string to GetData like this:

Dim myInnerData = myData.GetData("GongSolutions.Wpf.DragDrop")

And voila, you just got the object of the DragEventArgs.

As far as I know this is the only topic that has an answer regarding this specific problem.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900