DataTransferItem Class

An item of a drag data store (https://html.spec.whatwg.org/multipage/dnd.html#the-datatransferitem-interface).

public sealed class DataTransferItem

Properties

NameDescription
Kindhttps://html.spec.whatwg.org/multipage/dnd.html#dom-datatransferitem-kind
Typehttps://html.spec.whatwg.org/multipage/dnd.html#dom-datatransferitem-type

https://html.spec.whatwg.org/multipage/dnd.html#dom-datatransferitem-kind

public string Kind { get; }

https://html.spec.whatwg.org/multipage/dnd.html#dom-datatransferitem-type

public string Type { get; }

Methods

NameDescription
GetAsFile()https://html.spec.whatwg.org/multipage/dnd.html#dom-datatransferitem-getasfile
GetAsFileSystemHandle()Returns a handle to a file or a directory dropped from outside the user agent (https://wicg.github.io/file-system-access/#dom-datatransferitem-getasfilesystemhandle): a handle to a copy of the dropped files, that the page can read and change (the files of the disk do not change). The task completes with null for the other items, and while the drag data store is protected (before the drop).
GetAsString(FunctionStringCallback?)https://html.spec.whatwg.org/multipage/dnd.html#dom-datatransferitem-getasstring: the callback is invoked from a task.
WebkitGetAsEntry()Returns the entry of a file item (https://wicg.github.io/entries-api/#dom-datatransferitem-webkitgetasentry): a file or a directory dropped from outside the user agent (read the files of a directory with FileSystemDirectoryEntry.CreateReader), or a file added by a script. The root directory of its file system contains the files of the drag data store. Null for the text items, and while the drag data store is protected (before the drop).

GetAsFile()

DataTransfer.cs

https://html.spec.whatwg.org/multipage/dnd.html#dom-datatransferitem-getasfile

public File? GetAsFile()

GetAsFileSystemHandle()

DataTransfer.cs

Returns a handle to a file or a directory dropped from outside the user agent (https://wicg.github.io/file-system-access/#dom-datatransferitem-getasfilesystemhandle): a handle to a copy of the dropped files, that the page can read and change (the files of the disk do not change). The task completes with null for the other items, and while the drag data store is protected (before the drop).

public Task<FileSystemHandle?> GetAsFileSystemHandle()

GetAsString(FunctionStringCallback?)

DataTransfer.cs

https://html.spec.whatwg.org/multipage/dnd.html#dom-datatransferitem-getasstring: the callback is invoked from a task.

public void GetAsString(FunctionStringCallback? callback)

WebkitGetAsEntry()

DataTransfer.cs

Returns the entry of a file item (https://wicg.github.io/entries-api/#dom-datatransferitem-webkitgetasentry): a file or a directory dropped from outside the user agent (read the files of a directory with FileSystemDirectoryEntry.CreateReader), or a file added by a script. The root directory of its file system contains the files of the drag data store. Null for the text items, and while the drag data store is protected (before the drop).

public FileSystemEntry? WebkitGetAsEntry()