ClipboardItem Class

The data of a clipboard item (https://w3c.github.io/clipboard-apis/#clipboarditem): representations of the same data in different MIME types. An item created by navigator.clipboard.read() reads its data from the system clipboard when ClipboardItem.GetType is called, and fails when the clipboard changed since.

public sealed class ClipboardItem

Constructors

NameDescription
ClipboardItem(IEnumerable<KeyValuePair<string, StringOrBlob>>, ClipboardItemOptions?)Creates a clipboard item from data available synchronously.
ClipboardItem(IEnumerable<KeyValuePair<string, Task<StringOrBlob>>>, ClipboardItemOptions?)https://w3c.github.io/clipboard-apis/#dom-clipboarditem-clipboarditem

ClipboardItem overloads

ClipboardItem(IEnumerable<KeyValuePair<string, StringOrBlob>>, ClipboardItemOptions?)

ClipboardItem.cs

Creates a clipboard item from data available synchronously.

public ClipboardItem(IEnumerable<KeyValuePair<string, StringOrBlob>> items, ClipboardItemOptions? options = null)

ClipboardItem(IEnumerable<KeyValuePair<string, Task<StringOrBlob>>>, ClipboardItemOptions?)

ClipboardItem.cs

https://w3c.github.io/clipboard-apis/#dom-clipboarditem-clipboarditem

public ClipboardItem(IEnumerable<KeyValuePair<string, Task<StringOrBlob>>> items, ClipboardItemOptions? options = null)
Parameters
items IEnumerable<KeyValuePair<string, Task<StringOrBlob>>>
options ClipboardItemOptions?
Exceptions
TypeErrorException
items is empty, a type is not a valid MIME type, or two types are the same MIME type.
See also

Properties

NameDescription
PresentationStylehttps://w3c.github.io/clipboard-apis/#dom-clipboarditem-presentationstyle
TypesGets the MIME types of the representations (https://w3c.github.io/clipboard-apis/#dom-clipboarditem-types); the web custom formats have the web prefix.

PresentationStyle

ClipboardItem.cs

https://w3c.github.io/clipboard-apis/#dom-clipboarditem-presentationstyle

public PresentationStyle PresentationStyle { get; }

Gets the MIME types of the representations (https://w3c.github.io/clipboard-apis/#dom-clipboarditem-types); the web custom formats have the web prefix.

public IReadOnlyList<string> Types { get; }

Methods

NameDescription
GetType(string)Returns the data of the representation of a type as a blob (https://w3c.github.io/clipboard-apis/#dom-clipboarditem-gettype). The task fails with a NotFoundError DomException when there is no such representation, or an InvalidStateError when the item was read from the system clipboard and the clipboard changed since.
Supports(string)Whether the type is a mandatory or an optional data type (https://w3c.github.io/clipboard-apis/#dom-clipboarditem-supports).

GetType(string)

ClipboardItem.cs

Returns the data of the representation of a type as a blob (https://w3c.github.io/clipboard-apis/#dom-clipboarditem-gettype). The task fails with a NotFoundError DomException when there is no such representation, or an InvalidStateError when the item was read from the system clipboard and the clipboard changed since.

public Task<Blob> GetType(string type)

Parameters

type string

Returns

Task<Blob>

Exceptions

TypeErrorException
type is not a valid MIME type.

See also

Supports(string)

ClipboardItem.cs

Whether the type is a mandatory or an optional data type (https://w3c.github.io/clipboard-apis/#dom-clipboarditem-supports).

public static bool Supports(string type)