Skip to main content

DataTransferItem Class

A mutable implementation of IDataTransferItem and IAsyncDataTransferItem. This class also provides several static methods to easily create a DataTransferItem for common usages.

Definition

Namespace: Avalonia.Input
Assembly: Avalonia.Base (in Avalonia.Base.dll)

public sealed class DataTransferItem : IDataTransferItem, 
IAsyncDataTransferItem
View Source
InheritanceObject → DataTransferItem
ImplementsIAsyncDataTransferItem, IDataTransferItem

Remarks

While it also implements IAsyncDataTransferItem, this class always returns data synchronously. For advanced usages, consider implementing IAsyncDataTransferItem directly.

Constructors

DataTransferItem()Initializes a new instance of the DataTransferItem class

Properties

FormatsGets the formats supported by this item.

Methods

Create(T)(DataFormat(T), T)Creates a new DataTransferItem for a single format with a given value.
Create(T)(DataFormat(T), Func(T))Creates a new DataTransferItem for a single format with a given value created on demand.
CreateFile(IStorageItem)Creates a new DataTransferItem with File as a single format.
CreateText(String)Creates a new DataTransferItem with Text as a single format.
Equals(Object)Determines whether the specified object is equal to the current object.
(Inherited from Object)
GetHashCode()Serves as the default hash function.
(Inherited from Object)
GetType()Gets the Type of the current instance.
(Inherited from Object)
Set(T)(DataFormat(T), T)Sets the value for a given format.
Set(T)(DataFormat(T), Func(T))Sets a value created on demand for a given format.
SetFile(IStorageItem)Sets the value for the File format.
SetText(String)Sets the value for the Text format.
ToString()Returns a string that represents the current object.
(Inherited from Object)
TryGetRaw(DataFormat)Tries to get a value for a given format.

Extension Methods

Contains(DataFormat)Gets whether a IDataTransferItem supports a specific format.
(Defined by DataTransferItemExtensions)
Contains(DataFormat)Gets whether a IAsyncDataTransferItem supports a specific format.
(Defined by AsyncDataTransferItemExtensions)
TryGetFile()Returns a file, if available, from a IDataTransferItem instance.
(Defined by DataTransferItemExtensions)
TryGetFileAsync()Returns a file, if available, from a IAsyncDataTransferItem instance.
(Defined by AsyncDataTransferItemExtensions)
TryGetText()Returns a text, if available, from a IDataTransferItem instance.
(Defined by DataTransferItemExtensions)
TryGetTextAsync()Returns a text, if available, from a IAsyncDataTransferItem instance.
(Defined by AsyncDataTransferItemExtensions)
TryGetValue(T)(DataFormat(T))Tries to get a value for a given format from a IDataTransferItem.
(Defined by DataTransferItemExtensions)
TryGetValueAsync(T)(DataFormat(T))Tries to get a value for a given format from a IAsyncDataTransferItem.
(Defined by AsyncDataTransferItemExtensions)

See Also

Reference

Avalonia.Input Namespace