Override default style of the DragDrop event

Hey developers,

I’m trying to override the default style of the DragDrop events on my custom Eto form. Specifically, I’d like to replace the default tooltips which appear while dragging:
image

The Layers panel has a custom icon:
image

I tried using the overload accepting an image, but it still shows the default tooltip:

DoDragDrop(data, DragEffects.Move, Icon.FromResource("UI.Resources.Icons_Expand.png"), new PointF(70, 10));

image

Any suggestions are welcome!
@curtisw, @dale

Hi @mrhe,

Use DragEventArgs.SetDropDescription.

protected override void OnDragOver(DragEventArgs args)
{
  base.OnDragOver(args);

  if (args.Data.Contains(MyStuffType))
  {
     args.Effects = DragEffects.Move;
     if (args.SupportsDropDescription)
       args.SetDropDescription("Move MyStuff", null);
  }
  else
  {
    args.Effects = DragEffects.None;
    if (args.SupportsDropDescription)
      args.SetDropDescription(null, null);
  }
}

– Dale

Thanks @dale,

this still shows the popup with the default arrow, but I would like to completely get rid of it and replace it with my custom image. As shown in the original post, the layer panel does this somehow.

            if (e.SupportsDropDescription)
                e.SetDropDescription(null, null);

image

Hi @mrhe,

Try using the version of DoDragDrop that accepts an Image parameter.

– Dale

Thanks @dale,

the image does show, but the default popup is still there:
image

        protected override void OnMouseMove(MouseEventArgs e)
        {
            if (!_dragging && e.Buttons == MouseButtons.Primary )
            {
                _dragging = true;
                DoDragDrop(new DataObject(), DragEffects.Move, Icon.FromResource("UI.Resources.Icons_Expand.png"), new PointF(70, 10));
                //DoDragDrop(new DataObject(), DragEffects.Move);
                e.Handled = true;
            }
        }

protected override void OnDragOver(DragEventArgs e)
{
    e.Effects = DragEffects.Move;
    if (e.SupportsDropDescription)
        e.SetDropDescription(null, null);

// rest of the code
    Invalidate();
}

@curtisw - anyway to do not show the move/copy arrow?

– Dale

1 Like

Hey @mrhe,

Sorry for the late response. There currently isn’t a way to remove the tooltips, only change the text. The layers panel in v7 was using MFC and not using the shell-style drag/drop functionality of windows, but now in v8 uses Eto so it does have the same tooltip.

I looked into how one might be able to get rid of it, but unfortunately could not find an easy way yet without redoing the whole thing to not use shell drag/drop. I’ve created RH-81139 to look into it further.

1 Like

Thanks @curtisw!

It’d be great if the tooltip could be turned off. The default arrow looks like it has not been revisited since Windows 95…

1 Like