I´ve got a WinForms App where a form contains a WebView2 component as big as the form itself. The code below works fine on the form itself, since the WebView2 element lays on top of the form I´m not able to use the drag-drop functionality on the form and I have to use the WebView2´s one. But it doesnt work the way stated below.
this.webView21.AllowExternalDrop = false;
I set the external drop check to false since I dont want the file to be opened in a new window but just getting the file name dropped into the WebView2 element.
private void webView21_DragEnter(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent(DataFormats.FileDrop)) e.Effect = DragDropEffects.Copy;
}
private void webView21_DragDrop(object sender, DragEventArgs e)
{
string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);
label1.Text = files[0];
}
I want to get the (absolute) file name dropped into the view withouth opening a new window.
Like stated above
this.webView21.AllowExternalDrop = true;
just opens the file in a new window. Not desired.
During my “research” people hinted VS´s security concerns where it´s impossible to do this when using VS. Not using VS, not the problem.
I created two breakpoints for both events that never fired once.
Are these events useable at all?
Thanks in advance