Show / Hide Table of Contents

Class DataObject

Provides a basic implementation of the System.Windows.IDataObject interface, which defines a format-independent mechanism for transferring data.

Inheritance
System.Object
DataObject
Implements
IDataObject
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Microsoft.Windows
Assembly: OpenSilver.Controls.Toolkit.dll
Syntax
public sealed class DataObject : IDataObject

Constructors

| Improve this Doc View Source

DataObject()

Initializes a new instance of the DataObject class.

Declaration
public DataObject()
| Improve this Doc View Source

DataObject(Object)

Initializes a new instance of the DataObject class.

Declaration
public DataObject(object data)
Parameters
Type Name Description
System.Object data

An object that represents the data to store in this data object.

Methods

| Improve this Doc View Source

GetData(String)

Returns data in a format specified by a string.

Declaration
public object GetData(string format)
Parameters
Type Name Description
System.String format

A string that specifies the format for the data.

Returns
Type Description
System.Object

An object that contains the data in the specified format, or null if the data is unavailable in the specified format.

| Improve this Doc View Source

GetData(String, Boolean)

Returns data in a format specified by a string.

Declaration
public object GetData(string format, bool autoConvert)
Parameters
Type Name Description
System.String format

A string that specifies the format for the data.

System.Boolean autoConvert

True to attempt to automatically convert the data to the specified format; false for no data format conversion.

Returns
Type Description
System.Object

An object that contains the data in the specified format, or null if the data is unavailable in the specified format.

| Improve this Doc View Source

GetData(Type)

Returns a data object in a format specified by a System.Type object.

Declaration
public object GetData(Type format)
Parameters
Type Name Description
System.Type format

A System.Type that specifies the format for the data.

Returns
Type Description
System.Object

A data object with the data in the specified format, or null if the data is unavailable in the specified format.

| Improve this Doc View Source

GetDataPresent(String)

Determines whether the data is available in, or can be converted to, a format specified by a string.

Declaration
public bool GetDataPresent(string format)
Parameters
Type Name Description
System.String format

A string that specifies the format for the data.

Returns
Type Description
System.Boolean

True if the data is in, or can be converted to, the specified format; otherwise, false.

| Improve this Doc View Source

GetDataPresent(String, Boolean)

Determines whether the data is available in, or can be converted to, a format specified by a System.Type object.

Declaration
public bool GetDataPresent(string format, bool autoConvert)
Parameters
Type Name Description
System.String format

A System.Type that specifies the format for the data.

System.Boolean autoConvert

True to attempt to automatically convert the data to the specified format; false for no data format conversion.

Returns
Type Description
System.Boolean

An object that contains the data in the specified format, or null if the data is unavailable in the specified format.

| Improve this Doc View Source

GetDataPresent(Type)

Determines whether the data is available in, or can be converted to, a format specified by a System.Type object.

Declaration
public bool GetDataPresent(Type format)
Parameters
Type Name Description
System.Type format

A System.Type that specifies the format for the data.

Returns
Type Description
System.Boolean

True if the data is in, or can be converted to, the specified format; otherwise, false.

| Improve this Doc View Source

GetFormats()

Returns a list of formats in which the data in this data object is stored, or can be converted to.

Declaration
public string[] GetFormats()
Returns
Type Description
System.String[]

An array of strings, with each string specifying the name of a format that this data object supports.

| Improve this Doc View Source

GetFormats(Boolean)

Returns a list of formats in which the data in this data object is stored. A Boolean flag indicates whether to also include formats that the data can be automatically converted to.

Declaration
public string[] GetFormats(bool autoConvert)
Parameters
Type Name Description
System.Boolean autoConvert

True to attempt to automatically convert the data to the specified format; false for no data format conversion.

Returns
Type Description
System.String[]

An array of strings, with each string specifying the name of a format that this data object supports.

| Improve this Doc View Source

SetData(Object)

Stores the specified data in this data object, automatically determining the data format from the source object type.

Declaration
public void SetData(object data)
Parameters
Type Name Description
System.Object data

An object that represents the data to store in this data object.

| Improve this Doc View Source

SetData(String, Object)

Stores the specified data in this data object, automatically determining the data format from the source object type.

Declaration
public void SetData(string format, object data)
Parameters
Type Name Description
System.String format

A string that specifies the format for the data.

System.Object data

An object that represents the data to store in this data object.

| Improve this Doc View Source

SetData(String, Object, Boolean)

Stores the specified data in this data object, automatically determining the data format from the source object type.

Declaration
public void SetData(string format, object data, bool autoConvert)
Parameters
Type Name Description
System.String format

A string that specifies the format for the data.

System.Object data

An object that represents the data to store in this data object.

System.Boolean autoConvert

True to attempt to automatically convert the data to the specified format; false for no data format conversion.

| Improve this Doc View Source

SetData(Type, Object)

Stores the specified data in this data object, automatically determining the data format from the source object type.

Declaration
public void SetData(Type format, object data)
Parameters
Type Name Description
System.Type format

A System.Type that specifies the format for the data.

System.Object data

An object that represents the data to store in this data object.

Implements

IDataObject
  • Improve this Doc
  • View Source