DragEvent Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Represents an event that is sent out by the system at various times during a drag and drop operation.
[Android.Runtime.Register("android/view/DragEvent", DoNotGenerateAcw=true)]
public class DragEvent : Java.Lang.Object, Android.OS.IParcelable, IDisposable
[<Android.Runtime.Register("android/view/DragEvent", DoNotGenerateAcw=true)>]
type DragEvent = class
inherit Object
interface IParcelable
interface IJavaObject
interface IDisposable
interface IJavaPeerable
- Inheritance
- Attributes
- Implements
Remarks
Represents an event that is sent out by the system at various times during a drag and drop operation. It is a data structure that contains several important pieces of data about the operation and the underlying data.
View objects that receive a DragEvent call #getAction(), which returns an action type that indicates the state of the drag and drop operation. This allows a View object to react to a change in state by changing its appearance or performing other actions. For example, a View can react to the #ACTION_DRAG_ENTERED action type by by changing one or more colors in its displayed image.
During a drag and drop operation, the system displays an image that the user drags. This image is called a drag shadow. Several action types reflect the position of the drag shadow relative to the View receiving the event.
Most methods return valid data only for certain event actions. This is summarized in the following table. Each possible #getAction() value is listed in the first column. The other columns indicate which method or methods return valid data for that getAction() value:
<table> <tr> <th scope="col">getAction() Value</th> <th scope="col">getClipDescription()</th> <th scope="col">getLocalState()</th> <th scope="col">getX()</th> <th scope="col">getY()</th> <th scope="col">getClipData()</th> <th scope="col">getResult()</th> </tr> <tr> <td>ACTION_DRAG_STARTED</td> <td style="text-align: center;">X</td> <td style="text-align: center;">X</td> <td style="text-align: center;">X</td> <td style="text-align: center;">X</td> <td style="text-align: center;"> </td> <td style="text-align: center;"> </td> </tr> <tr> <td>ACTION_DRAG_ENTERED</td> <td style="text-align: center;">X</td> <td style="text-align: center;">X</td> <td style="text-align: center;"> </td> <td style="text-align: center;"> </td> <td style="text-align: center;"> </td> <td style="text-align: center;"> </td> </tr> <tr> <td>ACTION_DRAG_LOCATION</td> <td style="text-align: center;">X</td> <td style="text-align: center;">X</td> <td style="text-align: center;">X</td> <td style="text-align: center;">X</td> <td style="text-align: center;"> </td> <td style="text-align: center;"> </td> </tr> <tr> <td>ACTION_DRAG_EXITED</td> <td style="text-align: center;">X</td> <td style="text-align: center;">X</td> <td style="text-align: center;"> </td> <td style="text-align: center;"> </td> <td style="text-align: center;"> </td> <td style="text-align: center;"> </td> </tr> <tr> <td>ACTION_DROP</td> <td style="text-align: center;">X</td> <td style="text-align: center;">X</td> <td style="text-align: center;">X</td> <td style="text-align: center;">X</td> <td style="text-align: center;">X</td> <td style="text-align: center;"> </td> </tr> <tr> <td>ACTION_DRAG_ENDED</td> <td style="text-align: center;"> </td> <td style="text-align: center;">X</td> <td style="text-align: center;"> </td> <td style="text-align: center;"> </td> <td style="text-align: center;"> </td> <td style="text-align: center;">X</td> </tr> </table>
The android.view.DragEvent#getAction(), android.view.DragEvent#getLocalState()android.view.DragEvent#describeContents(), android.view.DragEvent#writeToParcel(Parcel,int), and android.view.DragEvent#toString() methods always return valid data.
<div class="special reference"> <h3>Developer Guides</h3>
For a guide to implementing drag and drop features, read the Drag and Drop developer guide.
</div>
Java documentation for android.view.DragEvent.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.
Constructors
| Name | Description |
|---|---|
| DragEvent(IntPtr, JniHandleOwnership) |
A constructor used when creating managed representations of JNI objects; called by the runtime. |
Properties
| Name | Description |
|---|---|
| Action |
Inspect the action value of this event. |
| Class |
Returns the runtime class of this |
| ClipData |
Returns the |
| ClipDescription |
Returns the |
| Creator |
A container for creating a DragEvent from a Parcel. |
| Handle |
The handle to the underlying Android instance. (Inherited from Object) |
| JniIdentityHashCode |
Gets the identity hash code assigned to this Java peer by the interop runtime. (Inherited from Object) |
| JniManagedPeerState | (Inherited from JavaObject) |
| JniPeerMembers |
Gets the JNI peer metadata used by the .NET for Android binding runtime. |
| LocalState |
Returns the local state object sent to the system as part of the call to
|
| PeerReference |
Gets the JNI object reference for this Java peer. (Inherited from Object) |
| Result |
Returns an indication of the result of the drag and drop operation. |
| ThresholdClass |
Gets the JNI class handle used by the .NET for Android binding runtime. |
| ThresholdType |
Gets the managed type used by the .NET for Android binding runtime. |
Methods
| Name | Description |
|---|---|
| Clone() |
Creates and returns a copy of this object. (Inherited from Object) |
| Construct(JniObjectReference, JniObjectReferenceOptions) | (Inherited from JavaObject) |
| DescribeContents() |
Returns information about the |
| Dispose() |
Releases the resources held by this Java peer. (Inherited from Object) |
| Dispose(Boolean) |
Releases the resources held by this Java peer. (Inherited from Object) |
| DisposeUnlessReferenced() | (Inherited from JavaObject) |
| Equals(Object) | (Inherited from JavaObject) |
| Equals(Object) |
Indicates whether some other object is "equal to" this one. (Inherited from Object) |
| GetHashCode() |
Returns a hash code value for the object. (Inherited from Object) |
| GetX() |
Gets the X coordinate of the drag point. The value is only valid if the event action is ACTION_DRAG_STARTED , ACTION_DRAG_LOCATION or ACTION_DROP . |
| GetY() |
Gets the Y coordinate of the drag point. The value is only valid if the event action is ACTION_DRAG_STARTED , ACTION_DRAG_LOCATION or ACTION_DROP . |
| JavaFinalize() |
Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. (Inherited from Object) |
| Notify() |
Wakes up a single thread that is waiting on this object's monitor. (Inherited from Object) |
| NotifyAll() |
Wakes up all threads that are waiting on this object's monitor. (Inherited from Object) |
| SetHandle(IntPtr, JniHandleOwnership) |
Sets the Handle property. (Inherited from Object) |
| SetPeerReference(JniObjectReference, JniObjectReferenceOptions) | (Inherited from JavaObject) |
| ToArray<T>() |
Creates a managed array from this Java array wrapper. (Inherited from Object) |
| ToString() |
Returns a string representation of the object. (Inherited from Object) |
| UnregisterFromRuntime() |
Unregisters this Java peer from the interop runtime. (Inherited from Object) |
| Wait() |
Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>. (Inherited from Object) |
| Wait(Int64, Int32) |
Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed. (Inherited from Object) |
| Wait(Int64) |
Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed. (Inherited from Object) |
| WriteToParcel(Parcel, ParcelableWriteFlags) |
Creates a |
Explicit Interface Implementations
| Name | Description |
|---|---|
| IJavaPeerable.Disposed() | (Inherited from JavaObject) |
| IJavaPeerable.Finalized() | (Inherited from JavaObject) |
| IJavaPeerable.JniObjectReferenceControlBlock | (Inherited from JavaObject) |
| IJavaPeerable.SetJniIdentityHashCode(Int32) | (Inherited from JavaObject) |
| IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) | (Inherited from JavaObject) |
| IJavaPeerable.SetPeerReference(JniObjectReference) | (Inherited from JavaObject) |
| IJavaPeerable.UnregisterFromRuntime() | |
Extension Methods
| Name | Description |
|---|---|
| GetJniTypeName(IJavaPeerable) |
Gets the JNI name of the type of the instance |
| JavaAs<TResult>(IJavaPeerable) |
Try to coerce |
| JavaCast<TResult>(IJavaObject) |
Performs an Android runtime-checked type conversion. |
| JavaCast<TResult>(IJavaObject) | |
| TryJavaCast<TResult>(IJavaPeerable, TResult) |
Try to coerce |