Class DataObject
Provides a basic implementation of the System.Windows.IDataObject interface, which defines a format-independent mechanism for transferring data.
Inheritance
Implements
Inherited Members
Namespace: Microsoft.Windows
Assembly: OpenSilver.Controls.Toolkit.dll
Syntax
public sealed class DataObject : IDataObject
Constructors
| Improve this Doc View SourceDataObject()
Initializes a new instance of the DataObject class.
Declaration
public DataObject()
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 SourceGetData(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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |