|
@@ -1,4 +1,5 @@
|
|
-using System.Threading.Tasks;
|
|
|
|
|
|
+using System;
|
|
|
|
+using System.Threading.Tasks;
|
|
using Avalonia.Input.Platform;
|
|
using Avalonia.Input.Platform;
|
|
using Avalonia.Interactivity;
|
|
using Avalonia.Interactivity;
|
|
|
|
|
|
@@ -41,6 +42,86 @@ namespace Avalonia.Input
|
|
interactive.SetValue(AllowDropProperty, value);
|
|
interactive.SetValue(AllowDropProperty, value);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// Adds a handler for the DragEnter attached event.
|
|
|
|
+ /// </summary>
|
|
|
|
+ /// <param name="element">The element to attach the handler to.</param>
|
|
|
|
+ /// <param name="handler">The handler for the event.</param>
|
|
|
|
+ public static void AddDragEnterHandler(Interactive element, EventHandler<DragEventArgs> handler)
|
|
|
|
+ {
|
|
|
|
+ element.AddHandler(DragEnterEvent, handler);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// Removes a handler for the DragEnter attached event.
|
|
|
|
+ /// </summary>
|
|
|
|
+ /// <param name="element">The element to remove the handler from.</param>
|
|
|
|
+ /// <param name="handler">The handler to remove.</param>
|
|
|
|
+ public static void RemoveDragEnterHandler(Interactive element, EventHandler<DragEventArgs> handler)
|
|
|
|
+ {
|
|
|
|
+ element.RemoveHandler(DragEnterEvent, handler);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// Adds a handler for the DragLeave attached event.
|
|
|
|
+ /// </summary>
|
|
|
|
+ /// <param name="element">The element to attach the handler to.</param>
|
|
|
|
+ /// <param name="handler">The handler for the event.</param>
|
|
|
|
+ public static void AddDragLeaveHandler(Interactive element, EventHandler<DragEventArgs> handler)
|
|
|
|
+ {
|
|
|
|
+ element.AddHandler(DragLeaveEvent, handler);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// Removes a handler for the DragLeave attached event.
|
|
|
|
+ /// </summary>
|
|
|
|
+ /// <param name="element">The element to remove the handler from.</param>
|
|
|
|
+ /// <param name="handler">The handler to remove.</param>
|
|
|
|
+ public static void RemoveDragLeaveHandler(Interactive element, EventHandler<DragEventArgs> handler)
|
|
|
|
+ {
|
|
|
|
+ element.RemoveHandler(DragLeaveEvent, handler);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// Adds a handler for the DragOver attached event.
|
|
|
|
+ /// </summary>
|
|
|
|
+ /// <param name="element">The element to attach the handler to.</param>
|
|
|
|
+ /// <param name="handler">The handler for the event.</param>
|
|
|
|
+ public static void AddDragOverHandler(Interactive element, EventHandler<DragEventArgs> handler)
|
|
|
|
+ {
|
|
|
|
+ element.AddHandler(DragOverEvent, handler);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// Removes a handler for the DragOver attached event.
|
|
|
|
+ /// </summary>
|
|
|
|
+ /// <param name="element">The element to remove the handler from.</param>
|
|
|
|
+ /// <param name="handler">The handler to remove.</param>
|
|
|
|
+ public static void RemoveDragOverHandler(Interactive element, EventHandler<DragEventArgs> handler)
|
|
|
|
+ {
|
|
|
|
+ element.RemoveHandler(DragOverEvent, handler);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// Adds a handler for the Drop attached event.
|
|
|
|
+ /// </summary>
|
|
|
|
+ /// <param name="element">The element to attach the handler to.</param>
|
|
|
|
+ /// <param name="handler">The handler for the event.</param>
|
|
|
|
+ public static void AddDropHandler(Interactive element, EventHandler<DragEventArgs> handler)
|
|
|
|
+ {
|
|
|
|
+ element.AddHandler(DropEvent, handler);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// Removes a handler for the Drop attached event.
|
|
|
|
+ /// </summary>
|
|
|
|
+ /// <param name="element">The element to remove the handler from.</param>
|
|
|
|
+ /// <param name="handler">The handler to remove.</param>
|
|
|
|
+ public static void RemoveDropHandler(Interactive element, EventHandler<DragEventArgs> handler)
|
|
|
|
+ {
|
|
|
|
+ element.RemoveHandler(DropEvent, handler);
|
|
|
|
+ }
|
|
|
|
+
|
|
/// <summary>
|
|
/// <summary>
|
|
/// Starts a dragging operation with the given <see cref="IDataObject"/> and returns the applied drop effect from the target.
|
|
/// Starts a dragging operation with the given <see cref="IDataObject"/> and returns the applied drop effect from the target.
|
|
/// <seealso cref="DataObject"/>
|
|
/// <seealso cref="DataObject"/>
|