Reputation: 2721
In a project using WPF I have allowed for dragging on the browser. Now I can drag and drop a file onto the whole browser. The document has a frame, which is only part of the whole document and it is only here that I would like to allow dragging.
My first thoughts are to use WPF's dragmove event to track the mouse movements while dragging, however I would need to know where the mouse is within the browser and when it enters the frame which is only a part of the document.
Does the CefSharp API expose the dimension of frames or its browser or window? On my check of IFrame, IBrowser I don't see them.
If not I suppose the only way to do this is to use javascript to get my target frames RECT on drag enter and then in the dragmove event check whether the mouse is within this RECT.
Upvotes: 0
Views: 338
Reputation: 1374
In the last CefSharp project I worked with, we used C# to detect whether the mouse is within the application window, and JS to detect when the mouse enters specific DOM elements. You could handle the drag/drop in JS.
Alternately, as you say, you could write some JS that runs when the page loads, measures the area of the frame, and then passes that information on to the C# side using the method demonstrated here.
Upvotes: 1