Skip to main content

ClipboardExtensions Class

Definition​

Assembly:Avalonia.Base
Package:Avalonia

Contains extension methods related to Avalonia.Input.Platform.IClipboard.

public class ClipboardExtensions

Inheritance: object -> ClipboardExtensions

Methods​

NameDescription
GetDataFormatsAsyncGets a list containing the formats currently available from the clipboard.
SetBitmapAsyncPlaces a bitmap on the clipboard.
SetFileAsyncPlaces a file on the clipboard.
SetFilesAsyncNo summary available.
SetTextAsyncPlaces a text on the clipboard.
SetValueAsyncNo summary available.
SetValuesAsyncNo summary available.
TryGetBitmapAsyncReturns a bitmap, if available, from the clipboard.
TryGetFileAsyncReturns a file, if available, from the clipboard.
TryGetFilesAsyncReturns a list of files, if available, from the clipboard.
TryGetTextAsyncReturns a text, if available, from the clipboard.
TryGetValueAsyncNo summary available.
TryGetValuesAsyncNo summary available.

GetDataFormatsAsync Method​

Gets a list containing the formats currently available from the clipboard.

public System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyList<Avalonia.Input.DataFormat>> GetDataFormatsAsync(Avalonia.Input.Platform.IClipboard clipboard)

Parameters​

clipboard Avalonia.Input.Platform.IClipboard

Returns​

System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyList<Avalonia.Input.DataFormat>>

A list of formats. It can be empty if the clipboard is empty.

SetBitmapAsync Method​

Places a bitmap on the clipboard.

public System.Threading.Tasks.Task SetBitmapAsync(Avalonia.Input.Platform.IClipboard clipboard, Avalonia.Media.Imaging.Bitmap bitmap)

Parameters​

clipboard Avalonia.Input.Platform.IClipboard

The clipboard instance.

bitmap Avalonia.Media.Imaging.Bitmap

The bitmap to place on the clipboard.

Returns​

System.Threading.Tasks.Task

Remarks​

By calling this method, the clipboard will get cleared of any possible previous data.

If bitmap is null, nothing will get placed on the clipboard and this method will be equivalent to Avalonia.Input.Platform.IClipboard.ClearAsync.

See also​

SetFileAsync Method​

Places a file on the clipboard.

public System.Threading.Tasks.Task SetFileAsync(Avalonia.Input.Platform.IClipboard clipboard, Avalonia.Platform.Storage.IStorageItem file)

Parameters​

clipboard Avalonia.Input.Platform.IClipboard

The clipboard instance.

file Avalonia.Platform.Storage.IStorageItem

The file to place on the clipboard.

Returns​

System.Threading.Tasks.Task

Remarks​

By calling this method, the clipboard will get cleared of any possible previous data.

If file is null, nothing will get placed on the clipboard and this method will be equivalent to Avalonia.Input.Platform.IClipboard.ClearAsync.

See also​

SetFilesAsync Method​

public System.Threading.Tasks.Task SetFilesAsync(Avalonia.Input.Platform.IClipboard clipboard, System.Collections.Generic.IEnumerable<Avalonia.Platform.Storage.IStorageItem> files)

Parameters​

clipboard Avalonia.Input.Platform.IClipboard

files System.Collections.Generic.IEnumerable<Avalonia.Platform.Storage.IStorageItem>

Returns​

System.Threading.Tasks.Task

SetTextAsync Method​

Places a text on the clipboard.

public System.Threading.Tasks.Task SetTextAsync(Avalonia.Input.Platform.IClipboard clipboard, string text)

Parameters​

clipboard Avalonia.Input.Platform.IClipboard

The clipboard instance.

text string

The value to place on the clipboard.

Returns​

System.Threading.Tasks.Task

Remarks​

By calling this method, the clipboard will get cleared of any possible previous data.

If text is null, nothing will get placed on the clipboard and this method will be equivalent to Avalonia.Input.Platform.IClipboard.ClearAsync.

See also​

SetValueAsync Method​

public System.Threading.Tasks.Task SetValueAsync<T>(Avalonia.Input.Platform.IClipboard clipboard, Avalonia.Input.DataFormat<T><T> format, T value)

Parameters​

clipboard Avalonia.Input.Platform.IClipboard

format Avalonia.Input.DataFormat<T><T>

value T

Type Parameters​

T

Returns​

System.Threading.Tasks.Task

SetValuesAsync Method​

public System.Threading.Tasks.Task SetValuesAsync<T>(Avalonia.Input.Platform.IClipboard clipboard, Avalonia.Input.DataFormat<T><T> format, System.Collections.Generic.IEnumerable<T> values)

Parameters​

clipboard Avalonia.Input.Platform.IClipboard

format Avalonia.Input.DataFormat<T><T>

values System.Collections.Generic.IEnumerable<T>

Type Parameters​

T

Returns​

System.Threading.Tasks.Task

TryGetBitmapAsync Method​

Returns a bitmap, if available, from the clipboard.

public System.Threading.Tasks.Task<Avalonia.Media.Imaging.Bitmap> TryGetBitmapAsync(Avalonia.Input.Platform.IClipboard clipboard)

Parameters​

clipboard Avalonia.Input.Platform.IClipboard

The clipboard instance.

Returns​

System.Threading.Tasks.Task<Avalonia.Media.Imaging.Bitmap>

A Avalonia.Media.Imaging.Bitmap, or null if the format isn't available.

See also​

TryGetFileAsync Method​

Returns a file, if available, from the clipboard.

public System.Threading.Tasks.Task<Avalonia.Platform.Storage.IStorageItem> TryGetFileAsync(Avalonia.Input.Platform.IClipboard clipboard)

Parameters​

clipboard Avalonia.Input.Platform.IClipboard

The clipboard instance.

Returns​

System.Threading.Tasks.Task<Avalonia.Platform.Storage.IStorageItem>

An Avalonia.Platform.Storage.IStorageItem (file or folder), or null if the format isn't available.

See also​

TryGetFilesAsync Method​

Returns a list of files, if available, from the clipboard.

public System.Threading.Tasks.Task<Avalonia.Platform.Storage.IStorageItem[]> TryGetFilesAsync(Avalonia.Input.Platform.IClipboard clipboard)

Parameters​

clipboard Avalonia.Input.Platform.IClipboard

The clipboard instance.

Returns​

System.Threading.Tasks.Task<Avalonia.Platform.Storage.IStorageItem[]>

An array of Avalonia.Platform.Storage.IStorageItem (files or folders), or null if the format isn't available.

See also​

TryGetTextAsync Method​

Returns a text, if available, from the clipboard.

public System.Threading.Tasks.Task<string> TryGetTextAsync(Avalonia.Input.Platform.IClipboard clipboard)

Parameters​

clipboard Avalonia.Input.Platform.IClipboard

The clipboard instance.

Returns​

System.Threading.Tasks.Task<string>

A string, or null if the format isn't available.

See also​

TryGetValueAsync Method​

public System.Threading.Tasks.Task<T> TryGetValueAsync<T>(Avalonia.Input.Platform.IClipboard clipboard, Avalonia.Input.DataFormat<T><T> format)

Parameters​

clipboard Avalonia.Input.Platform.IClipboard

format Avalonia.Input.DataFormat<T><T>

Type Parameters​

T

Returns​

System.Threading.Tasks.Task<T>

TryGetValuesAsync Method​

public System.Threading.Tasks.Task<T[]> TryGetValuesAsync<T>(Avalonia.Input.Platform.IClipboard clipboard, Avalonia.Input.DataFormat<T><T> format)

Parameters​

clipboard Avalonia.Input.Platform.IClipboard

format Avalonia.Input.DataFormat<T><T>

Type Parameters​

T

Returns​

System.Threading.Tasks.Task<T[]>