Skip to content
This repository has been archived by the owner on Nov 1, 2024. It is now read-only.

Commit

Permalink
Merge pull request #136 from fitdev/master
Browse files Browse the repository at this point in the history
Preserve Selection on List Item Drag
  • Loading branch information
wieslawsoltes authored Apr 2, 2024
2 parents b58d0e4 + 62b1eb4 commit 218d2ea
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using Avalonia.Controls;
using Avalonia.Input;
using Avalonia.Interactivity;
using Avalonia.LogicalTree;
using Avalonia.Xaml.Interactivity;

namespace Avalonia.Xaml.Interactions.DragAndDrop;
Expand Down Expand Up @@ -136,6 +137,7 @@ private void AssociatedObject_PointerPressed(object? sender, PointerPressedEvent
if (e.Source is Control control
&& AssociatedObject?.DataContext == control.DataContext)
{
if ((control as ISelectable ?? control.Parent as ISelectable ?? control.FindLogicalAncestorOfType<ISelectable>())?.IsSelected ?? false) e.Handled = true; //avoid deselection on drag
_dragStartPoint = e.GetPosition(null);
_triggerEvent = e;
_lock = true;
Expand Down

0 comments on commit 218d2ea

Please sign in to comment.