diff --git a/src/Avalonia.Input/DragDrop/DragDrop.cs b/src/Avalonia.Input/DragDrop/DragDrop.cs index 9d68deb62b..0cbbfb1dbe 100644 --- a/src/Avalonia.Input/DragDrop/DragDrop.cs +++ b/src/Avalonia.Input/DragDrop/DragDrop.cs @@ -6,21 +6,39 @@ namespace Avalonia.Input.DragDrop { public static class DragDrop { + /// + /// Event which is raised, when a drag-and-drop operation enters the element. + /// public static RoutedEvent DragEnterEvent = RoutedEvent.Register("DragEnter", RoutingStrategies.Bubble, typeof(DragDrop)); + /// + /// Event which is raised, when a drag-and-drop operation leaves the element. + /// public static RoutedEvent DragLeaveEvent = RoutedEvent.Register("DragLeave", RoutingStrategies.Bubble, typeof(DragDrop)); + /// + /// Event which is raised, when a drag-and-drop operation is updated while over the element. + /// public static RoutedEvent DragOverEvent = RoutedEvent.Register("DragOver", RoutingStrategies.Bubble, typeof(DragDrop)); + /// + /// Event which is raised, when a drag-and-drop operation should complete over the element. + /// public static RoutedEvent DropEvent = RoutedEvent.Register("Drop", RoutingStrategies.Bubble, typeof(DragDrop)); - public static AvaloniaProperty AcceptDragProperty = AvaloniaProperty.RegisterAttached("AcceptDrag", typeof(DragDrop), inherits: true); + public static AvaloniaProperty AllowDropProperty = AvaloniaProperty.RegisterAttached("AllowDrop", typeof(DragDrop), inherits: true); - public static bool GetAcceptDrag(Interactive interactive) + /// + /// Gets a value indicating whether the given element can be used as the target of a drag-and-drop operation. + /// + public static bool GetAllowDrop(Interactive interactive) { - return interactive.GetValue(AcceptDragProperty); + return interactive.GetValue(AllowDropProperty); } - - public static void SetAcceptDrag(Interactive interactive, bool value) + + /// + /// Sets a value indicating whether the given interactive can be used as the target of a drag-and-drop operation. + /// + public static void SetAllowDrop(Interactive interactive, bool value) { - interactive.SetValue(AcceptDragProperty, value); + interactive.SetValue(AllowDropProperty, value); } /// diff --git a/src/Avalonia.Input/DragDrop/DragDropDevice.cs b/src/Avalonia.Input/DragDrop/DragDropDevice.cs index 0a64800346..7ef6f212f8 100644 --- a/src/Avalonia.Input/DragDrop/DragDropDevice.cs +++ b/src/Avalonia.Input/DragDrop/DragDropDevice.cs @@ -15,7 +15,7 @@ namespace Avalonia.Input.DragDrop private Interactive GetTarget(IInputElement root, Point local) { var target = root.InputHitTest(local)?.GetSelfAndVisualAncestors()?.OfType()?.FirstOrDefault(); - if (target != null && DragDrop.GetAcceptDrag(target)) + if (target != null && DragDrop.GetAllowDrop(target)) return target; return null; } diff --git a/src/Avalonia.Input/DragDrop/IDataObject.cs b/src/Avalonia.Input/DragDrop/IDataObject.cs index 5d26a20cee..bf2d00f529 100644 --- a/src/Avalonia.Input/DragDrop/IDataObject.cs +++ b/src/Avalonia.Input/DragDrop/IDataObject.cs @@ -2,16 +2,38 @@ namespace Avalonia.Input.DragDrop { + /// + /// Interface to access information about the data of a drag-and-drop operation. + /// public interface IDataObject { + /// + /// Lists all formats which are present in the DataObject. + /// + /// IEnumerable GetDataFormats(); + /// + /// Checks wether a given DataFormat is present in this object + /// + /// bool Contains(string dataFormat); + /// + /// Returns the dragged text if the DataObject contains any text. + /// + /// string GetText(); + /// + /// Returns a list of filenames if the DataObject contains filenames. + /// + /// IEnumerable GetFileNames(); + /// + /// Tries to get the data of the given DataFormat. + /// object Get(string dataFormat); } } \ No newline at end of file