Eto Froms TreeGridView drag and drop


Is there an easy way to do row-reordering/row drag and drop between TreeGridView rows?

I see a GetDragInfo function, but it is not clear how could I use it.

I guess I could use DragEnter,DragDrop etc events, but under OSX these are not working for me.


1 Like

Any info about it?

And especially about Eto drag and drop OSX? Is it really broken (not implemented) or I do something wrong?


@curtisw, is this something you can help with?

Hi @marton.parlagh,

Yes drag/drop is implemented on macOS. You need to set AllowDrop = true for those events to be wired up. Eto does not provide automatic reordering of the tree itself though, so you will have to implement moving and refreshing the tree yourself.

A good resource on how to implement dragging on a TreeGridView is in the Eto.Test application. In particular how to start a drag, and how to accept a drop and also how to select where to allow a drop in a TreeGridView.

In particular, the GetDragInfo used from the DragOver/DragDrop event can be used to determine where the node should be inserted, and how to restrict where exactly you allow the drop to occur (over/insert/etc).

Hope this helps!

Thanks for the code!
You are right, it actually works under OSX - which is great.

But I think my original code was also right but it was not working. (Bug?)
It seems it is not enough to use DataObject SetObject(…) because in this way dragging is not working. Now I have added a dummy SetString(…) value too to the DataObject, and it is working…