DataObject Class
TOC
Collapse the table of content
Expand the table of content

DataObject Class

 

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

Namespace:   System.Windows
Assembly:  PresentationCore (in PresentationCore.dll)

System.Object
  System.Windows.DataObject

public sealed class DataObject : IDataObject, IDataObject

NameDescription
System_CAPS_pubmethodDataObject()

Initializes a new instance of the DataObject class.

System_CAPS_pubmethodDataObject(Object)

Initializes a new instance of the DataObject class that contains the specified data.

System_CAPS_pubmethodDataObject(String, Object)

Initializes a new instance of the DataObject class that contains the specified data and its associated format; the format is specified by a string.

System_CAPS_pubmethodDataObject(String, Object, Boolean)

Initializes a new instance of the DataObject class that contains the specified data and its associated format; the format is specified by a string. This overload includes a Boolean flag to indicate whether the data may be converted to another format on retrieval.

System_CAPS_pubmethodDataObject(Type, Object)

Initializes a new instance of the DataObject class that contains the specified data and its associated format; the data format is specified by a Type object.

NameDescription
System_CAPS_pubmethodSystem_CAPS_staticAddCopyingHandler(DependencyObject, DataObjectCopyingEventHandler)

Adds a Copying event handler to a specified dependency object.

System_CAPS_pubmethodSystem_CAPS_staticAddPastingHandler(DependencyObject, DataObjectPastingEventHandler)

Adds a Pasting event handler to a specified dependency object.

System_CAPS_pubmethodSystem_CAPS_staticAddSettingDataHandler(DependencyObject, DataObjectSettingDataEventHandler)

Adds a SettingData event handler to a specified dependency object.

System_CAPS_pubmethodContainsAudio()

Queries a data object for the presence of data in the WaveAudio data format.

System_CAPS_pubmethodContainsFileDropList()

Queries a data object for the presence of data in the FileDrop data format.

System_CAPS_pubmethodContainsImage()

Queries a data object for the presence of data in the Bitmap data format.

System_CAPS_pubmethodContainsText()

Queries a data object for the presence of data in the UnicodeText format.

System_CAPS_pubmethodContainsText(TextDataFormat)

Queries a data object for the presence of data in a text data format.

System_CAPS_pubmethodEquals(Object)

Determines whether the specified object is equal to the current object.(Inherited from Object.)

System_CAPS_pubmethodGetAudioStream()

Returns a stream that contains data in the WaveAudio data format.

System_CAPS_pubmethodGetData(String)

Returns data in a format specified by a string.

System_CAPS_pubmethodGetData(String, Boolean)

Returns a data object in a specified format, optionally converting the data to the specified format.

System_CAPS_pubmethodGetData(Type)

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

System_CAPS_pubmethodGetDataPresent(String)

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

System_CAPS_pubmethodGetDataPresent(String, Boolean)

Determines 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.

System_CAPS_pubmethodGetDataPresent(Type)

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

System_CAPS_pubmethodGetFileDropList()

Returns a string collection that contains a list of dropped files.

System_CAPS_pubmethodGetFormats()

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

System_CAPS_pubmethodGetFormats(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.

System_CAPS_pubmethodGetHashCode()

Serves as the default hash function. (Inherited from Object.)

System_CAPS_pubmethodGetImage()

Returns a BitmapSource object that contains data in the Bitmap format.

System_CAPS_pubmethodGetText()

Returns a string that contains the UnicodeText data in this data object.

System_CAPS_pubmethodGetText(TextDataFormat)

Returns a string that contains text data of the specified format in this data object.

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_pubmethodSystem_CAPS_staticRemoveCopyingHandler(DependencyObject, DataObjectCopyingEventHandler)

Removes a Copying event handler from a specified dependency object.

System_CAPS_pubmethodSystem_CAPS_staticRemovePastingHandler(DependencyObject, DataObjectPastingEventHandler)

Removes a Pasting event handler from a specified dependency object.

System_CAPS_pubmethodSystem_CAPS_staticRemoveSettingDataHandler(DependencyObject, DataObjectSettingDataEventHandler)

Removes a SettingData event handler from a specified dependency object.

System_CAPS_pubmethodSetAudio(Byte[])

Stores audio data (WaveAudio data format) in this data object. The audio data is specified as a byte array.

System_CAPS_pubmethodSetAudio(Stream)

Stores audio data (WaveAudio data format) in this data object. The audio data is specified as a stream.

System_CAPS_pubmethodSetData(Object)

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

System_CAPS_pubmethodSetData(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.

System_CAPS_pubmethodSetData(String, Object, Boolean)

Stores the specified data in this data object, along with one or more specified data formats. This overload includes a Boolean flag to indicate whether the data can be converted to another format on retrieval.

System_CAPS_pubmethodSetData(Type, Object)

Stores the specified data in this data object, along with one or more specified data formats; the data format is specified by a Type object.

System_CAPS_pubmethodSetFileDropList(StringCollection)

Stores FileDrop data in this data object. The dropped file list is specified as a string collection.

System_CAPS_pubmethodSetImage(BitmapSource)

Stores Bitmap data in this data object. The image data is specified as a BitmapSource.

System_CAPS_pubmethodSetText(String)

Stores UnicodeText data, specified as a string, in this data object.

System_CAPS_pubmethodSetText(String, TextDataFormat)

Stores text data in this data object. The format of the text data to store is specified with a member of TextDataFormat.

System_CAPS_pubmethodToString()

Returns a string that represents the current object.(Inherited from Object.)

NameDescription
System_CAPS_pubfieldSystem_CAPS_staticCopyingEvent

Identifies the Copying attached event.

System_CAPS_pubfieldSystem_CAPS_staticPastingEvent

Identifies the Pasting attached event.

System_CAPS_pubfieldSystem_CAPS_staticSettingDataEvent

Identifies the SettingData attached event.

NameDescription
System_CAPS_pubeventSystem_CAPS_staticCopying

Occurs when the associated dependency object has prepared appropriate data formats that represent the copy selection, added the copy selection formats to a DataObject, and is ready to either place the DataObject on the Clipboard or begin a drag-and-drop operation.

System_CAPS_pubeventSystem_CAPS_staticPasting

Occurs when the associated dependency object is ready to paste data.

System_CAPS_pubeventSystem_CAPS_staticSettingData

Occurs when the associated dependency object attempts to add a new data format to a DataObject.

NameDescription
System_CAPS_pubinterfaceSystem_CAPS_privmethodIDataObject.DAdvise(FORMATETC, ADVF, IAdviseSink, Int32)

Creates a connection between a data object and an advisory sink. This method is called by an object that supports an advisory sink and enables the advisory sink to be notified of changes in the object's data.

System_CAPS_pubinterfaceSystem_CAPS_privmethodIDataObject.DUnadvise(Int32)

Destroys a notification connection that had been previously established.

System_CAPS_pubinterfaceSystem_CAPS_privmethodIDataObject.EnumDAdvise(IEnumSTATDATA)

Creates an object that can be used to enumerate the current advisory connections.

System_CAPS_pubinterfaceSystem_CAPS_privmethodIDataObject.EnumFormatEtc(DATADIR)

Creates an object for enumerating the FORMATETC structures for a data object. These structures are used in calls to GetData or SetData.

System_CAPS_pubinterfaceSystem_CAPS_privmethodIDataObject.GetCanonicalFormatEtc(FORMATETC, FORMATETC)

Provides a standard FORMATETC structure that is logically equivalent to a more complex structure. Use this method to determine whether two different FORMATETC structures would return the same data, removing the need for duplicate rendering.

System_CAPS_pubinterfaceSystem_CAPS_privmethodIDataObject.GetData(FORMATETC, STGMEDIUM)

Obtains data from a source data object. The GetData method, which is called by a data consumer, renders the data described in the specified FORMATETC structure and transfers it through the specified STGMEDIUM structure. The caller then assumes responsibility for releasing the STGMEDIUM structure.

System_CAPS_pubinterfaceSystem_CAPS_privmethodIDataObject.GetDataHere(FORMATETC, STGMEDIUM)

Obtains data from a source data object. This method, which is called by a data consumer, differs from the GetData method in that the caller must allocate and free the specified storage medium.

System_CAPS_pubinterfaceSystem_CAPS_privmethodIDataObject.QueryGetData(FORMATETC)

Determines whether the data object is capable of rendering the data described in the FORMATETC structure. Objects attempting a paste or drop operation can call this method before calling GetData to get an indication of whether the operation may be successful.

System_CAPS_pubinterfaceSystem_CAPS_privmethodIDataObject.SetData(FORMATETC, STGMEDIUM, Boolean)

Transfers data to the object that implements this method. This method is called by an object that contains a data source.

The following example shows how to use this class.

string stringData = "Some string data to store...";
string dataFormat = DataFormats.UnicodeText;
DataObject dataObject = new DataObject(dataFormat, stringData);

.NET Framework
Available since 3.0
Silverlight
Available since 4.0

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show:
© 2016 Microsoft