From a7d1fc614611e573fd4e9cac620bef41679108c9 Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Tue, 28 Mar 2023 18:06:03 +0200 Subject: [PATCH] Merge pull request #157 from AvaloniaUI/fixes/row-drop-event Correctly raise the RowDrop event. --- src/Avalonia.Controls.TreeDataGrid/TreeDataGrid.cs | 4 ++-- .../TreeDataGridRowDragEventArgs.cs | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Avalonia.Controls.TreeDataGrid/TreeDataGrid.cs b/src/Avalonia.Controls.TreeDataGrid/TreeDataGrid.cs index 697de359..b63aab61 100644 --- a/src/Avalonia.Controls.TreeDataGrid/TreeDataGrid.cs +++ b/src/Avalonia.Controls.TreeDataGrid/TreeDataGrid.cs @@ -583,7 +583,7 @@ private void OnDragOver(DragEventArgs e) if (route.HasHandlers) { - var ev = new TreeDataGridRowDragEventArgs(row, e); + var ev = new TreeDataGridRowDragEventArgs(RowDragOverEvent, row, e); ev.Position = adorner; RaiseEvent(ev); adorner = ev.Position; @@ -618,7 +618,7 @@ private void OnDrop(DragEventArgs e) if (route.HasHandlers) { - var ev = new TreeDataGridRowDragEventArgs(row, e); + var ev = new TreeDataGridRowDragEventArgs(RowDropEvent, row, e); ev.Position = position; RaiseEvent(ev); diff --git a/src/Avalonia.Controls.TreeDataGrid/TreeDataGridRowDragEventArgs.cs b/src/Avalonia.Controls.TreeDataGrid/TreeDataGridRowDragEventArgs.cs index 6112e6f3..7fc5447a 100644 --- a/src/Avalonia.Controls.TreeDataGrid/TreeDataGridRowDragEventArgs.cs +++ b/src/Avalonia.Controls.TreeDataGrid/TreeDataGridRowDragEventArgs.cs @@ -21,10 +21,11 @@ public class TreeDataGridRowDragEventArgs : RoutedEventArgs /// /// Initializes a new instance of the class. /// + /// The event being raised. /// The row that is being dragged over. /// The inner drag event args. - public TreeDataGridRowDragEventArgs(TreeDataGridRow row, DragEventArgs inner) - : base(TreeDataGrid.RowDragOverEvent) + public TreeDataGridRowDragEventArgs(RoutedEvent routedEvent, TreeDataGridRow row, DragEventArgs inner) + : base(routedEvent) { TargetRow = row; Inner = inner;