SunnySonic
SunnySonic

Reputation: 1336

UWP drag and drop onto WebView

Is there any possibility to drop an external file onto a WebView in a Windows UWP app?

I know about :

AllowDrop="True" Drop="WebView_Drop" DragOver="WebView_DragOver"

I was able to copy files that i dragged into the clipboard and use it then on other items like displaying them as an image etc.

Besides that I don't see any way to interact directly with the webview or am i wrong? The current page the webview is showing is allowing to drop media files into it and i would like to use that feature in the webview...

Upvotes: 1

Views: 935

Answers (1)

Alias Varghese
Alias Varghese

Reputation: 2170

WebView does not support drop event. WebView doesn’t support most of the user input events inherited from UIElement, such as KeyDown, KeyUp, and PointerPressed. A common workaround is to use InvokeScriptAsync with the JavaScript eval function to use the HTML event handlers, and to use window.external.notify from the HTML event handler to notify the application using WebView.ScriptNotify

Upvotes: 1

Related Questions