[Gtk-sharp-list] Problem with drag and drop expand-on-hover for a TreeView

Matthew Pirocchi matthew.pirocchi at gmail.com
Wed Mar 3 16:57:33 EST 2010

I have a handler that looks like this in my TreeView:

void HandleDragMotion (object o, DragMotionArgs args)
	TreePath path;
	TreeViewDropPosition pos;
	if (!GetDestRowAtPos (args.X, args.Y, out path, out pos))
	if (pos == TreeViewDropPosition.Before)
		SetDragDestRow (path, TreeViewDropPosition.IntoOrBefore);
	else if (pos == TreeViewDropPosition.After)
		SetDragDestRow (path, TreeViewDropPosition.IntoOrAfter);
	Gdk.Drag.Status (args.Context, args.Context.SuggestedAction, args.Time);
	args.RetVal = true;


DragMotion += HandleDragMotion;

Basically all it does is make sure you can only drop ON rows, not
BETWEEN them. My problem is that this disables expand-on-hover for
drag and drop. If I get rid of the last line (args.RetVal = true;),
expand-on-hover is enabled again, but so is dropping between rows.

Is there any way to achieve both of these things? Theoretically, I
should be able to just implement the expand-on-hover myself, but I
can't find any code for what it's supposed to look like. I tried using
the ExpandHover property (turing it on on DragBegin, and off on
DragEnd), but it only expands the first row that you hover over, then
stops working.

Any ideas?

More information about the Gtk-sharp-list mailing list