EyeAuras Docs EyeAuras Docs
EyeAuras Docs EyeAuras Docs
DocFX + Singulink = ♥

Search Results for

    Method RegisterFileDropTarget

    RegisterFileDropTarget(ElementReference)

    Registers a DOM element as a file drop target within the WebView2-based Blazor UI.

    Declaration
    Task RegisterFileDropTarget(ElementReference elementRef)
    Parameters
    Type Name Description
    ElementReference elementRef

    A reference to the HTML element that should accept dropped files.

    Returns
    Type Description
    Task

    A Task representing the asynchronous operation of enabling the file drop target.

    Remarks

    This method typically invokes a JavaScript function (e.g., registerFileDropTarget) to attach dragover and drop event listeners to the specified element. When files are dropped onto the element, they are posted to the WebView2 host via window.chrome.webview.postMessageWithAdditionalObjects.

    The host application can handle these messages through the WebView2 CoreWebView2.WebMessageReceived event, receiving each file as a CoreWebView2File.

    Requires WebView2 SDK version 1.0.1518.46 or later, which supports postMessageWithAdditionalObjects.

    Examples
    await RegisterFileDropTarget(myElementRef);
    2025 © Xab3r. All rights reserved.