DataTransferItem Class
Definition
A mutable implementation of Avalonia.Input.IDataTransferItem and Avalonia.Input.IAsyncDataTransferItem. This class also provides several static methods to easily create a Avalonia.Input.DataTransferItem for common usages.
public class DataTransferItem
Remarks
While it also implements Avalonia.Input.IAsyncDataTransferItem, this class always returns data synchronously. For advanced usages, consider implementing Avalonia.Input.IAsyncDataTransferItem directly.
Constructors
| Name | Description |
|---|---|
| DataTransferItem | No summary available. |
DataTransferItem Constructor
public DataTransferItem()
Methods
| Name | Description |
|---|---|
| Create (2 overloads) | No summary available. |
| CreateFile | Creates a new Avalonia.Input.DataTransferItem with Avalonia.Input.DataFormat.File as a single format. |
| CreateText | Creates a new Avalonia.Input.DataTransferItem with Avalonia.Input.DataFormat.Text as a single format. |
| Set (2 overloads) | No summary available. |
| SetBitmap | Sets the value for the Avalonia.Input.DataFormat.Bitmap format. |
| SetFile | Sets the value for the Avalonia.Input.DataFormat.File format. |
| SetText | Sets the value for the Avalonia.Input.DataFormat.Text format. |
| TryGetRaw | Tries to get a value for a given format. |
Create overloads
Create Method
public Avalonia.Input.DataTransferItem Create<T>(Avalonia.Input.DataFormat<T><T> format, Func<T> getValue)
Parameters
format Avalonia.Input.DataFormat<T><T>
getValue Func<T>
Type Parameters
T
Returns
Create Method
public Avalonia.Input.DataTransferItem Create<T>(Avalonia.Input.DataFormat<T><T> format, T value)
Parameters
format Avalonia.Input.DataFormat<T><T>
value T
Type Parameters
T
Returns
CreateFile Method
Creates a new Avalonia.Input.DataTransferItem with Avalonia.Input.DataFormat.File as a single format.
public Avalonia.Input.DataTransferItem CreateFile(Avalonia.Platform.Storage.IStorageItem value)
Parameters
value Avalonia.Platform.Storage.IStorageItem
The value corresponding to the Avalonia.Input.DataFormat.File format. If null, the format won't be part of the Avalonia.Input.DataTransferItem.
Returns
Avalonia.Input.DataTransferItem
A Avalonia.Input.DataTransferItem instance.
CreateText Method
Creates a new Avalonia.Input.DataTransferItem with Avalonia.Input.DataFormat.Text as a single format.
public Avalonia.Input.DataTransferItem CreateText(string value)
Parameters
value string
The value corresponding to the Avalonia.Input.DataFormat.Text format. If null, the format won't be part of the Avalonia.Input.DataTransferItem.
Returns
Avalonia.Input.DataTransferItem
A Avalonia.Input.DataTransferItem instance.
Set overloads
Set Method
public void Set<T>(Avalonia.Input.DataFormat<T><T> format, Func<T> getValue)
Parameters
format Avalonia.Input.DataFormat<T><T>
getValue Func<T>
Type Parameters
T
Set Method
public void Set<T>(Avalonia.Input.DataFormat<T><T> format, T value)
Parameters
format Avalonia.Input.DataFormat<T><T>
value T
Type Parameters
T
SetBitmap Method
Sets the value for the Avalonia.Input.DataFormat.Bitmap format.
public void SetBitmap(Avalonia.Media.Imaging.Bitmap value)
Parameters
value Avalonia.Media.Imaging.Bitmap
The value corresponding to the Avalonia.Input.DataFormat.Bitmap format. If null, the format won't be part of the Avalonia.Input.DataTransferItem.
SetFile Method
Sets the value for the Avalonia.Input.DataFormat.File format.
public void SetFile(Avalonia.Platform.Storage.IStorageItem value)
Parameters
value Avalonia.Platform.Storage.IStorageItem
The value corresponding to the Avalonia.Input.DataFormat.File format. If null, the format won't be part of the Avalonia.Input.DataTransferItem.
SetText Method
Sets the value for the Avalonia.Input.DataFormat.Text format.
public void SetText(string value)
Parameters
value string
The value corresponding to the Avalonia.Input.DataFormat.Text format. If null, the format won't be part of the Avalonia.Input.DataTransferItem.
TryGetRaw Method
Tries to get a value for a given format.
public object TryGetRaw(Avalonia.Input.DataFormat format)
Parameters
format Avalonia.Input.DataFormat
The format to retrieve.
Returns
object
A value for format, or null if the format is not supported.
Remarks
Implementations of this method are expected to return a value matching the exact type of the generic argument of the underlying Avalonia.Input.DataFormat<T>.
To retrieve a typed value, use Avalonia.Input.DataTransferItemExtensions.TryGetValue<T>(Avalonia.Input.IDataTransferItem,Avalonia.Input.DataFormat{<>}).
See also
Properties
| Name | Description |
|---|---|
| Formats | Gets the formats supported by this item. |
Formats Property
Gets the formats supported by this item.
public System.Collections.Generic.IReadOnlyList<Avalonia.Input.DataFormat> Formats { get; set; }