diff --git a/src/SamplesApp/SamplesApp.UITests/Windows_UI_Xaml/DragAndDropTests/DragDrop_ListViewReorder_Automated.cs b/src/SamplesApp/SamplesApp.UITests/Windows_UI_Xaml/DragAndDropTests/DragDrop_ListViewReorder_Automated.cs
index ccee6f39da00..00f278e02d9b 100644
--- a/src/SamplesApp/SamplesApp.UITests/Windows_UI_Xaml/DragAndDropTests/DragDrop_ListViewReorder_Automated.cs
+++ b/src/SamplesApp/SamplesApp.UITests/Windows_UI_Xaml/DragAndDropTests/DragDrop_ListViewReorder_Automated.cs
@@ -15,10 +15,39 @@ namespace SamplesApp.UITests.Windows_UI_Xaml.DragAndDropTests
public partial class DragDrop_ListViewReorder_Automated : SampleControlUITestBase
{
private static readonly string[] _items = new[] { "#FF0018", "#FFA52C", "#FFFF41", "#008018", "#0000F9", "#86007D" };
- private const int _itemHeight = 100;
+ private const int _itemHeight = 90;
private static float Item(IAppRect sut, int index) => sut.Y + (index * _itemHeight) + 25;
+ [Test]
+ [AutoRetry]
+ [ActivePlatforms(Platform.Browser)] // TODO: support drag-and-drop testing on mobile https://github.com/unoplatform/Uno.UITest/issues/31
+ public void When_Disabled()
+ {
+ Run("UITests.Windows_UI_Xaml.DragAndDrop.DragDrop_ListView", skipInitialScreenshot: true);
+
+ var sut = _app.Marked("SUT");
+ var mode = _app.Marked("DragMode");
+
+ mode.SetDependencyPropertyValue("IsChecked", "False");
+
+ var before = TakeScreenshot("Before", ignoreInSnapshotCompare: true);
+
+ // Attempt to re-order
+ var sutBounds = _app.Query(sut).Single().Rect;
+ var x = sutBounds.X + 50;
+ var srcY = Item(sutBounds, 1);
+ var dstY = Item(sutBounds, 3);
+
+ _app.DragCoordinates(x, srcY, x, dstY);
+
+ var after = TakeScreenshot("After", ignoreInSnapshotCompare: true);
+
+ // note: we test only 100 pixels width to avoid failure due to scrollbar being visible in "after" screenshot
+ var testBounds = new Rectangle((int)sutBounds.X, (int)sutBounds.Y, 100, (int)sutBounds.Height);
+ ImageAssert.AreEqual(before, after, testBounds);
+ }
+
[Test]
[AutoRetry]
[ActivePlatforms(Platform.Browser)] // TODO: support drag-and-drop testing on mobile https://github.com/unoplatform/Uno.UITest/issues/31
diff --git a/src/SamplesApp/UITests.Shared/Windows_UI_Xaml/DragAndDrop/DragDrop_ListView.xaml b/src/SamplesApp/UITests.Shared/Windows_UI_Xaml/DragAndDrop/DragDrop_ListView.xaml
index 1ff554f5a136..5d7a8a5860c7 100644
--- a/src/SamplesApp/UITests.Shared/Windows_UI_Xaml/DragAndDrop/DragDrop_ListView.xaml
+++ b/src/SamplesApp/UITests.Shared/Windows_UI_Xaml/DragAndDrop/DragDrop_ListView.xaml
@@ -14,21 +14,25 @@
-
+
-
+
+
+
+
+
diff --git a/src/Uno.UI/UI/Xaml/Controls/ListViewBase/ListViewBase.DragDrop.cs b/src/Uno.UI/UI/Xaml/Controls/ListViewBase/ListViewBase.DragDrop.cs
index 9e77a6bdefe8..7e7008c49deb 100644
--- a/src/Uno.UI/UI/Xaml/Controls/ListViewBase/ListViewBase.DragDrop.cs
+++ b/src/Uno.UI/UI/Xaml/Controls/ListViewBase/ListViewBase.DragDrop.cs
@@ -106,6 +106,7 @@ private static void ClearContainerForDragDrop(UIElement itemContainer)
return;
}
+ itemContainer.CanDrag = false;
itemContainer.DragStarting -= OnItemContainerDragStarting;
itemContainer.DropCompleted -= OnItemContainerDragCompleted;
diff --git a/src/Uno.UI/UI/Xaml/DragDrop/DragDropManager.cs b/src/Uno.UI/UI/Xaml/DragDrop/DragDropManager.cs
index 65f12dd594ca..b4d0b72c9ebb 100644
--- a/src/Uno.UI/UI/Xaml/DragDrop/DragDropManager.cs
+++ b/src/Uno.UI/UI/Xaml/DragDrop/DragDropManager.cs
@@ -102,7 +102,7 @@ public DataPackageOperation ProcessAborted(IDragEventSource src)
=> FindOperation(src)?.Aborted(src) ?? DataPackageOperation.None;
private DragOperation? FindOperation(IDragEventSource src)
- => _dragOperations.FirstOrDefault(drag => drag.Info.SourceId == src.Id);
+ => _dragOperations.FirstOrDefault(drag => drag.Info.SourceId == src.Id);
private void RegisterWindowHandlers()
{