Class DataObject
Provides a basic implementation of the IDataObject interface, which defines a format-independent mechanism for transferring data.
Inheritance
Implements
Inherited Members
Namespace: System.Windows
Assembly: OpenSilver.dll
Syntax
public 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, with specified initial data.
Declaration
public DataObject(object data)
Parameters
Type | Name | Description |
---|---|---|
System.Object | data | An object that represents the data to store in this data object. |
Exceptions
Type | Condition |
---|---|
System.NotImplementedException | Not implemented. |
Methods
| Improve this Doc View SourceGetData(String)
Retrieves a data object in a specified format; the data format is specified by a string.
Declaration
public object GetData(string format)
Parameters
Type | Name | Description |
---|---|---|
System.String | format | A string that specifies what format to retrieve the data as. Use the constant System.Windows.DataFormats.FileDrop. |
Returns
Type | Description |
---|---|
System.Object | A data object that has the data in the specified format, or null if the data |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | format is not equivalent to System.Windows.DataFormats.FileDrop. |
System.Security.SecurityException | Attempted access in a mode other than Drop. |
GetData(String, Boolean)
Retrieves a data object in a specified format, optionally converting the data to the specified format. Always throws an exception.
Declaration
public object GetData(string format, bool autoConvert)
Parameters
Type | Name | Description |
---|---|---|
System.String | format | A string that specifies the format in which to retrieve 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 | Always throws an exception. |
Exceptions
Type | Condition |
---|---|
System.NotImplementedException | Not implemented. |
System.Security.SecurityException | Attempted access in a mode other than Drop. |
GetData(Type)
Retrieves a data object in a specified format; the data format is specified by a System.Type object. Always throws an exception.
Declaration
public object GetData(Type format)
Parameters
Type | Name | Description |
---|---|---|
System.Type | format | A System.Type object that specifies the format in which to retrieve the data. |
Returns
Type | Description |
---|---|
System.Object | Always throws an exception. |
Exceptions
Type | Condition |
---|---|
System.NotImplementedException | Not implemented. |
System.Security.SecurityException | Attempted access in a mode other than Drop. |
GetDataPresent(String)
Checks to see whether the data is available in, or can be converted to, a specified format; the data format is specified by a string.
Declaration
public bool GetDataPresent(string format)
Parameters
Type | Name | Description |
---|---|---|
System.String | format | A string that specifies the format to check for. See the System.Windows.DataFormats class for a set of predefined data formats. |
Returns
Type | Description |
---|---|
System.Boolean | true if the data is in the specified format, and is not null. false if format is not equivalent to FileDrop, or if the data is null. |
Exceptions
Type | Condition |
---|---|
System.Security.SecurityException | Attempted access in a mode other than Drop. |
GetDataPresent(String, Boolean)
Checks whether the data is available in, or can be converted to, a specified format. A Boolean flag indicates whether to check if the data can be converted to the specified format, if it is not available in that format. Always throws an exception.
Declaration
public bool GetDataPresent(string format, bool autoConvert)
Parameters
Type | Name | Description |
---|---|---|
System.String | format | A string that specifies the format to check for. See the DataFormats class for a set of predefined data formats. |
System.Boolean | autoConvert | false to only check for the specified format; true to also check whether data stored in this data object can be converted to the specified format. |
Returns
Type | Description |
---|---|
System.Boolean | Always throws an exception. |
Exceptions
Type | Condition |
---|---|
System.NotImplementedException | Not implemented. |
System.Security.SecurityException | Attempted access in a mode other than Drop. |
GetDataPresent(Type)
Checks whether the data is available in, or can be converted to, a specified format. The data format is specified by a System.Type object. Always throws an exception.
Declaration
public bool GetDataPresent(Type format)
Parameters
Type | Name | Description |
---|---|---|
System.Type | format | A System.Type that specifies the format to check for. |
Returns
Type | Description |
---|---|
System.Boolean | Always throws an exception. |
Exceptions
Type | Condition |
---|---|
System.NotImplementedException | Not implemented. |
System.Security.SecurityException | Attempted access in a mode other than Drop. |
GetFormats()
Returns a list of all formats that the data in this data object is stored in, 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 supported by this data object. |
Exceptions
Type | Condition |
---|---|
System.Security.SecurityException | Attempted access in a mode other than Drop. |
GetFormats(Boolean)
Returns a list of all formats that the data in this data object is stored in. A Boolean flag indicates whether to also include formats that the data can be automatically converted to. Always throws an exception.
Declaration
public string[] GetFormats(bool autoConvert)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | autoConvert | true to retrieve all formats that data in this data object is stored in, or converted to; false to retrieve only formats that data stored in this data object is stored in (excluding formats that the data is not stored in, but can be automatically converted to). |
Returns
Type | Description |
---|---|
System.String[] | Always throws an exception. |
Exceptions
Type | Condition |
---|---|
System.NotImplementedException | Not implemented. |
System.Security.SecurityException | Attempted access in a mode other than Drop. |
SetData(Object)
Stores the specified data in this data object and automatically converts the data format from the source object type. Always throws an exception.
Declaration
public void SetData(object data)
Parameters
Type | Name | Description |
---|---|---|
System.Object | data | The data to store in this data object. |
Exceptions
Type | Condition |
---|---|
System.NotImplementedException | Not implemented. |
System.Security.SecurityException | Attempted access in a mode other than Drop. |
SetData(String, Object)
Stores the specified data in this data object, along with one or more specified data formats. The data format is specified by a string. Always throws an exception.
Declaration
public void SetData(string format, object data)
Parameters
Type | Name | Description |
---|---|---|
System.String | format | A string that specifies what format to store the data in. See the DataFormats class for a set of predefined data formats. |
System.Object | data | The data to store in this data object. |
Exceptions
Type | Condition |
---|---|
System.NotImplementedException | Not implemented. |
System.Security.SecurityException | Attempted access in a mode other than Drop. |
SetData(String, Object, Boolean)
Stores the specified data in this data object, together with one or more specified data formats. This overload includes a Boolean flag to indicate whether the data may be converted to another format on retrieval. Always throws an exception.
Declaration
public void SetData(string format, object data, bool autoConvert)
Parameters
Type | Name | Description |
---|---|---|
System.String | format | A string that specifies the format in which to store the data. See the DataFormats class for a set of predefined data formats. |
System.Object | data | The data to store in this data object. |
System.Boolean | autoConvert | true to allow the data to be converted to another format on retrieval; false to prohibit the data from being converted to another format on retrieval. |
Exceptions
Type | Condition |
---|---|
System.NotImplementedException | Not implemented. |
System.Security.SecurityException | Attempted access in a mode other than Drop. |
SetData(Type, Object)
Stores the specified data in this data object, together with one or more specified data formats. The data format is specified by a System.Type class. Always throws an exception.
Declaration
public void SetData(Type format, object data)
Parameters
Type | Name | Description |
---|---|---|
System.Type | format | A System.Type that specifies the format in which to store the data. |
System.Object | data | The data to store in this data object. |
Exceptions
Type | Condition |
---|---|
System.NotImplementedException | Not implemented. |
System.Security.SecurityException | Attempted access in a mode other than Drop. |