I’m trying to create a list of controls which can be re-ordered by the user dragging a control to a different place in the list. I call DoDragDrop in the MouseDown event. While DragEnter, DragOver, DragLeave events will fire properly, DragDrop events never fire.
This is using Eto on Windows for Rhino 6. Any help would be appreciated. Thank you.
TestList.cs (2.3 KB)
I’m happy to have a look at this. But I’d like to know a little more about what you are trying to, as using a bunch of labels may not be the correct approach. Can you explain what you are looking to do and why?
Hi @dale ,
Sure thing. The list of items represents curves to be machined in a particular order. The user picks curves which populates the list. Then the user can select one or more of these list items using the shift and ctrl convention, click buttons which toggle the selected curves’ properties, rename them, and also drag and reorder them in the list.
When the user drags the selected item in the list, a visual indicator appears showing them where in the list the dropped item will go. I planned to use a set spacing between the items in the list and draw this indicator in their container’s Paint event handler.
Rather than using a number of Label controls, you’ll want to create a GridView control, which is a virtualized grid of data with editable cells. A
GridView also supports drag and drop so you could re-order your curve items.
Yes, thank you. I will give it a go.
Update with GridView:
I am in the same situation as I was with the Labels. I do not understand what conditions must be met so that a DragDrop event fires when the mouse button releases.
TestList.cs (2.8 KB)
I’ll put together a sample for you.
See if the attached sample is helpful or not.
SampleCsOrderCurves.cs (6.9 KB)
Thank you @dale. This is very helpful.
The calls to the drag data DataObject’s SetObject and GetObject methods caused StackOverflowExceptions. By storing a byte array instead of an object by calling SetData and GetData, the problem went away.
This is a known issue in the WIP. We’ll get it resolved soon.