admin管理员组文章数量:1355535
I am relatively new to .NET MAUI and am trying to implement a simple drag-and-drop function in a Razor component in a .NET MAUI Blazor hybrid app.
My problem: Only the dragstart event fires, while dragover and drop do not arrive. Also, I don't see any drag animation.
I noticed that .NET MAUI Blazor Hybrid does not enable interactive rendering by default, even though the events (drag, dragover, drop etc.) are defined in blazor.webview.js.
Here is a simple test code i've tried:
page "/dragdrop-test"
<div draggable="true" ondragstart="OnDragStart" style="background: lightblue; padding: 10px; width: 100px;">
Drag me!
</div>
<div ondragover="OnDragOver" ondragover:preventDefault ondrop="OnDrop" style="border: 2px dashed red; padding: 20px; height: 100px;">
Drop here!
</div>
<p>Log: logMessage</p>
code {
private string logMessage = "Waiting...";
private void OnDragStart(DragEventArgs args) => logMessage = "Drag started";
private void OnDragOver(DragEventArgs args) => logMessage = "Drag over";
private void OnDrop(DragEventArgs args) => logMessage = "Dropped";
}
In a Blazor WebAssembly app this works perfectly (all events + animation), but in MAUI Hybrid only dragstart.
My questions:
Is the problem with the WebView2 under Windows, which does not process dragover and drop correctly or does not recognize drop targets?
Or is it because blazor.webview.js intercepts the events but does not transfer them correctly to the .NET MAUI runtime?
Is there a way to make this work in MAUI Hybrid without detours (e.g. complete JS interop)?
I currently have the WebView2 runtime and the events are clearly defined in blazor.webview.js. What could be the problem? Thanks for your help!
本文标签: cDrag and drop in NET MAUI Blazor Hybrid not working – WebView2 or interop issueStack Overflow
版权声明:本文标题:c# - Drag and drop in .NET MAUI Blazor Hybrid not working – WebView2 or interop issue? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744051750a2582549.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论