DataFormat Class
Definition
Represents a format usable with the clipboard and drag-and-drop.
public class DataFormat
Methods
| Name | Description |
|---|---|
| CreateBytesApplicationFormat | Creates a new format specific to the application that returns an array of byte. |
| CreateBytesPlatformFormat | Creates a new format for the current platform that returns an array of byte. |
| CreateStringApplicationFormat | Creates a new format specific to the application that returns a string. |
| CreateStringPlatformFormat | Creates a new format for the current platform that returns a string. |
| Equals (2 overloads) | No summary available. |
| GetHashCode | No summary available. |
| ToString | No summary available. |
| ToSystemName | Creates a name for this format, usable by the underlying platform. |
CreateBytesApplicationFormat Method
Creates a new format specific to the application that returns an array of byte.
public Avalonia.Input.DataFormat<T><byte[]> CreateBytesApplicationFormat(string identifier)
Parameters
identifier string
The format identifier. To avoid conflicts with system identifiers, this value isn't passed to the underlying platform directly. However, two different applications using the same identifier with Avalonia.Input.DataFormat.CreateBytesApplicationFormat(string) or Avalonia.Input.DataFormat.CreateStringApplicationFormat(string) are able to share data using this format.
Only ASCII letters (A-Z, a-z), digits (0-9), the dot (.) and the hyphen (-) are accepted.
Returns
Avalonia.Input.DataFormat<T><byte[]>
A new Avalonia.Input.DataFormat.
CreateBytesPlatformFormat Method
Creates a new format for the current platform that returns an array of byte.
public Avalonia.Input.DataFormat<T><byte[]> CreateBytesPlatformFormat(string identifier)
Parameters
identifier string
The format identifier. This value is not validated and is passed AS IS to the underlying platform. Most systems use mime types, but macOS requires Uniform Type Identifiers (UTI).
Returns
Avalonia.Input.DataFormat<T><byte[]>
A new Avalonia.Input.DataFormat.
CreateStringApplicationFormat Method
Creates a new format specific to the application that returns a string.
public Avalonia.Input.DataFormat<T><string> CreateStringApplicationFormat(string identifier)
Parameters
identifier string
The format identifier. To avoid conflicts with system identifiers, this value isn't passed to the underlying platform directly. However, two different applications using the same identifier with Avalonia.Input.DataFormat.CreateBytesApplicationFormat(string) or Avalonia.Input.DataFormat.CreateStringApplicationFormat(string) are able to share data using this format.
Only ASCII letters (A-Z, a-z), digits (0-9), the dot (.) and the hyphen (-) are accepted.
Returns
Avalonia.Input.DataFormat<T><string>
A new Avalonia.Input.DataFormat.
CreateStringPlatformFormat Method
Creates a new format for the current platform that returns a string.
public Avalonia.Input.DataFormat<T><string> CreateStringPlatformFormat(string identifier)
Parameters
identifier string
The format identifier. This value is not validated and is passed AS IS to the underlying platform. Most systems use mime types, but macOS requires Uniform Type Identifiers (UTI).
Returns
Avalonia.Input.DataFormat<T><string>
A new Avalonia.Input.DataFormat.
Equals overloads
Equals Method
public bool Equals(Avalonia.Input.DataFormat other)
Parameters
other Avalonia.Input.DataFormat
Returns
bool
Equals Method
public bool Equals(object obj)
Parameters
obj object
Returns
bool
GetHashCode Method
public int GetHashCode()
Returns
int
ToString Method
public string ToString()
Returns
string
ToSystemName Method
Creates a name for this format, usable by the underlying platform.
public string ToSystemName(string applicationPrefix)
Parameters
applicationPrefix string
The system prefix used to recognize the name as an application format.
Returns
string
A system name for the format.
Remarks
This method can only be called if Avalonia.Input.DataFormat.Kind is Avalonia.Input.DataFormatKind.Application or Avalonia.Input.DataFormatKind.Platform.
Properties
| Name | Description |
|---|---|
| Bitmap | Gets a data format representing a bitmap. Its data type is Avalonia.Media.Imaging.Bitmap. |
| File | Gets a data format representing a single file. Its data type is Avalonia.Platform.Storage.IStorageItem. |
| Identifier | Gets the identifier of the data format. |
| Kind | Gets the kind of the data format. |
| Text | Gets a data format representing plain text. Its data type is string. |
Bitmap Property
Gets a data format representing a bitmap. Its data type is Avalonia.Media.Imaging.Bitmap.
public Avalonia.Input.DataFormat<T><Avalonia.Media.Imaging.Bitmap> Bitmap { get; set; }
File Property
Gets a data format representing a single file. Its data type is Avalonia.Platform.Storage.IStorageItem.
public Avalonia.Input.DataFormat<T><Avalonia.Platform.Storage.IStorageItem> File { get; set; }
Identifier Property
Gets the identifier of the data format.
public string Identifier { get; set; }
Kind Property
Gets the kind of the data format.
public Avalonia.Input.DataFormatKind Kind { get; set; }
Text Property
Gets a data format representing plain text. Its data type is string.
public Avalonia.Input.DataFormat<T><string> Text { get; set; }