DataTransfer Class

Exposes the drag data store of a drag-and-drop operation (https://html.spec.whatwg.org/multipage/dnd.html#the-datatransfer-interface). The objects created for the drag-and-drop events are only associated with the drag data store while the event is dispatched.

public sealed class DataTransfer

Constructors

NameDescription
DataTransfer()https://html.spec.whatwg.org/multipage/dnd.html#dom-datatransfer

DataTransfer()

DataTransfer.cs

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

public DataTransfer()

Properties

NameDescription
DropEffecthttps://html.spec.whatwg.org/multipage/dnd.html#dom-datatransfer-dropeffect
EffectAllowedhttps://html.spec.whatwg.org/multipage/dnd.html#dom-datatransfer-effectallowed
FilesThe files of the drag data store (https://html.spec.whatwg.org/multipage/dnd.html#dom-datatransfer-files): a live list, empty in the protected mode.
Itemshttps://html.spec.whatwg.org/multipage/dnd.html#dom-datatransfer-items
TypesThe types array (https://html.spec.whatwg.org/multipage/dnd.html#dom-datatransfer-types): the same array until the drag data store item list changes.

DropEffect

DataTransfer.cs

https://html.spec.whatwg.org/multipage/dnd.html#dom-datatransfer-dropeffect

public string DropEffect { get; set; }

EffectAllowed

DataTransfer.cs

https://html.spec.whatwg.org/multipage/dnd.html#dom-datatransfer-effectallowed

public string EffectAllowed { get; set; }

The files of the drag data store (https://html.spec.whatwg.org/multipage/dnd.html#dom-datatransfer-files): a live list, empty in the protected mode.

public FileList Files { get; }

https://html.spec.whatwg.org/multipage/dnd.html#dom-datatransfer-items

public DataTransferItemList Items { get; }

The types array (https://html.spec.whatwg.org/multipage/dnd.html#dom-datatransfer-types): the same array until the drag data store item list changes.

public IReadOnlyList<string> Types { get; }

Methods

NameDescription
ClearData(string?)https://html.spec.whatwg.org/multipage/dnd.html#dom-datatransfer-cleardata
GetData(string)https://html.spec.whatwg.org/multipage/dnd.html#dom-datatransfer-getdata
SetData(string, string)https://html.spec.whatwg.org/multipage/dnd.html#dom-datatransfer-setdata
SetDragImage(Element, int, int)https://html.spec.whatwg.org/multipage/dnd.html#dom-datatransfer-setdragimage

ClearData(string?)

DataTransfer.cs

https://html.spec.whatwg.org/multipage/dnd.html#dom-datatransfer-cleardata

public void ClearData(string? format = null)

GetData(string)

DataTransfer.cs

https://html.spec.whatwg.org/multipage/dnd.html#dom-datatransfer-getdata

public string GetData(string format)

SetData(string, string)

DataTransfer.cs

https://html.spec.whatwg.org/multipage/dnd.html#dom-datatransfer-setdata

public void SetData(string format, string data)

SetDragImage(Element, int, int)

DataTransfer.cs

https://html.spec.whatwg.org/multipage/dnd.html#dom-datatransfer-setdragimage

public void SetDragImage(Element image, int x, int y)