Skip to content

How to implement drag & drop with CefSharp WinForms #1593

@robinrodricks

Description

@robinrodricks

I'm currently intercepting the OnDragEnter event that CefSharp provides, but I want to handle the OnDragDrop event which does not exist. I am already handling the form's drop drop event and I've set form.AllowDrop = true, but since CEF intercepts the drag, I cannot handle it in the form!

In IDragHandler.OnDragEnter:

  • If I return true, then the user cannot drag anything on the browser (and I don't get the event);
  • If I return false, then the user can drag a file, but CefSharp handles it internally! (and I don't get the event)

So either ways I'm jammed. Is there any way to properly implement drag & drop in CefSharp, such that CefSharp/CEF does NOT do its default behaviour, and such that I get the DROP event handler. (or similar)

Alternatively, if CefSharp can use RevokeDragDrop (also here) in the OnDragEnter event, (in response to AllowDrop = false) then I can handle the drop event on the form itself.

Alternatively, If I can get access to these CEF flags then I can disable the internal drag/drop entirely and so fallback to the form's handling. Edit: Not possible in CEF3.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions