Table of Contents

Class DataTransferItemList

Namespace
CSharpToJavaScript.APIs.JS
Assembly
CSharpToJavaScript.dll

The DataTransferItemList object is a list of DataTransferItem objects representing items being dragged. During a drag operation, each DragEvent has a DataTransfer property and that property is a DataTransferItemList.

[Value("DataTransferItemList")]
public class DataTransferItemList
Inheritance
DataTransferItemList
Inherited Members

Remarks

The individual items can be accessed using the bracket notation [].

DataTransferItemList was primarily designed for the HTML Drag and Drop API, and is still specified in the HTML drag-and-drop section, but it is now also used by other APIs, such as ClipboardData and DataTransfer. Documentation of DataTransferItemList will primarily discuss its usage in drag-and-drop operations, and you should refer to the other APIs' documentation for usage of DataTransferItemList in those contexts.

This interface has no constructor.

See also on MDN

Constructors

DataTransferItemList()

public DataTransferItemList()

Properties

Length

The read-only length property of the
DataTransferItemList interface returns the number of items currently in
the drag item list.

[Value("length")]
public ulong Length { get; }

Property Value

ulong

The number of drag data items in the list, or 0 if the list is empty or disabled. The
drag item list is considered to be disabled if the item list's
DataTransfer object is not associated with a drag data store.

Remarks

Methods

Add(File)

The DataTransferItemList.add() method creates a new
DataTransferItem using the specified data and adds it to the drag data
list. The item may be a File or a string of a
given type. If the item is successfully added to the list, the newly-created
DataTransferItem object is returned.

[Value("add")]
public DataTransferItem? Add(File data)

Parameters

data File

Returns

DataTransferItem

A DataTransferItem containing the specified data. If the drag item
couldn't be created (for example, if the associated DataTransfer object
has no data store), null is returned.

Remarks

Add(string, string)

The DataTransferItemList.add() method creates a new
DataTransferItem using the specified data and adds it to the drag data
list. The item may be a File or a string of a
given type. If the item is successfully added to the list, the newly-created
DataTransferItem object is returned.

[Value("add")]
public DataTransferItem? Add(string data, string type)

Parameters

data string
type string

Returns

DataTransferItem

A DataTransferItem containing the specified data. If the drag item
couldn't be created (for example, if the associated DataTransfer object
has no data store), null is returned.

Remarks

Clear()

The DataTransferItemList method
clear() removes all DataTransferItem
objects from the drag data items list, leaving the list empty.

[Value("clear")]
public GlobalObject.Undefined Clear()

Returns

GlobalObject.Undefined

None (GlobalObject.Undefined).

Remarks

The drag data store in which this list is kept is only writable while handling the
HTMLElementdragstart event. While handling HTMLElementdrop, the drag data store is
in read-only mode, and this method silently does nothing. No exception is thrown.

See also on MDN

Remove(ulong)

The DataTransferItemList.remove() method removes the
DataTransferItem at the specified index from the list. If the index is
less than zero or greater than one less than the length of the list, the list will not
be changed.

[Value("remove")]
public GlobalObject.Undefined Remove(ulong index)

Parameters

index ulong

Returns

GlobalObject.Undefined

None (GlobalObject.Undefined).

Remarks