|
|
Questions and answers for Data DragandDrop.
|
35.Data DragandDrop
|
| 35.1 What are the
objects involved in DragandDrop?
|
| 35.2 How do I create a
DataObject?
|
| 35.3 How do I retrieve
data from a DataObject ?
|
35.1 What are the objects involved in DragandDrop?
|
|
The following are the some of the objects involved in the DragandDrop process.
-
Drag Source - Object from which an object is dragged from.
-
Drag Object - An object which is dragged.
-
Drag Target - Object into which the dragged object is dropped.
|
35.2 How do I create a DataObject?
|
|
A DataObject can be created in three different overloads of the DataObject
constructor.
-
DataObject (object) – In this case, appropriate DataFormat is assigned to the
DataObject based on the type of data stored in the object. By default,
auto-conversion option is set to 'true'.
|
[C#]
string mystring = "Drag and Drop String Object";
DataObject dataobject = new DataObject(mystring);
|
-
DataObject (DataFormat, object) – In this case, DataFormat is mentioned when
the DataObject is created.
|
[C#]
string mystring = "Drag and Drop String Object";
DataObject dataobject = new DataObject(DataFormats.UnicodeText,mystring);
|