IDataObject

References
public interface IDataObject
Interface to allow you to share common code with Clipboard and DataObject.

Properties

ContainsHtml

#
bool ContainsHtml { get; }
Gets a value indicating whether this IDataObject contains a value for Html.

ContainsImage

#
bool ContainsImage { get; }
Gets a value indicating whether this IDataObject contains a value for Image.

ContainsText

#
bool ContainsText { get; }
Gets a value indicating whether this IDataObject contains a value for Text.

ContainsUris

#
bool ContainsUris { get; }
Gets a value indicating whether this IDataObject contains a value for Uris.
Remarks: This can be a mix of both URL and File objects. You can use Uri.IsFile to test for that. On some platforms, (e.g. windows), only a single URL can be retrieved or set.
true if the data object contains uris; otherwise, false.

Html

#
string Html { get; set; }
Gets or sets html text in the data object.
The html value in the data object, or null if no html in the data object.

Image

#
Image Image { get; set; }
Gets or sets an image in the data object.
The image in the data object, or null if no image is in the data object.

Text

#
string Text { get; set; }
Gets or sets the plain text in the data object.
The plain text in the data object, or null if no plain text string in the data object.

Types

#
string[] Types { get; }
Gets the type id's for each type of data in the data object.

Uris

#
Uri[] Uris { get; set; }
Gets or sets the Uri's of the files in the data object.
Remarks: This can be a mix of both URL and File objects. You can use Uri.IsFile to test for that. On some platforms, (e.g. windows), only a single URL can be retrieved or set.
The uris of the files, or null if no files are in the data object.

Methods

Contains

#
bool Contains(string type)
Gets a value indicating that data with the specified type is contained in the data object.
type (string)Type to test.
true if the data object contains the specified type, false otherwise.

GetData

#
byte[] GetData(string type)
Gets a data array from the data object with the specified type identifier.
type (string)Type identifier that was used to store the data.
The data array, or null if not found in the data object.

GetObject

#
object GetObject(string type, Type objectType)
Gets an object from the data object with the specified type
Remarks: This is useful when you know the type of object, and it is serializable or has a type converter to convert from string. If it cannot be converted it will return the default value.
type (string)Type identifier to get from the data object
objectType (Type)Type of the object to get, or null to detect type
An instance of the object to recieve, or the default value.

GetObject

#
object GetObject(string type)
Gets a serialized value with the specified type identifier.
type (string)type identifier to get the value for.
Value of the object if deserializable, otherwise null.

GetObject<T>

#
T GetObject<T>(string type)
Gets an object from the data object with the specified type
Remarks: This is useful when you know the type of object, and it is serializable or has a type converter to convert from string. If it cannot be converted it will return the default value.
type (string)Type identifier to get from the data object
An instance of the object to recieve, or the default value.

GetString

#
string GetString(string type)
Gets a string from the data object with the specified type identifier.
type (string)Type identifier that was used to store the data.
The string.

SetData

#
void SetData(byte[] value, string type)
sets a data array into the data object with the specified type identifier.
value (byte[])Data to store in the data object.
type (string)Type identifier to store the data.

SetObject

#
void SetObject(object value, string type)
Sets the value into the data object with the specified type using serialization or type converter
Remarks: The object specified must be serializable or have a type converter to convert to a string.
value (object)Serializable value to set as a value in the data object
type (string)Type identifier to set the value for

SetString

#
void SetString(string value, string type)
Sets a string into the data object with the specified type identifier.
Remarks: This is useful when setting alternate string values into the data object that are not plain text. If you are storing plain text, use the Text property instead.
value (string)Value to set in the data object.
type (string)Type identifier that was used to store the data.