Skip to content

Commit

Permalink
fix: Fix ListView dragging not reverting back to NotDragging state
Browse files Browse the repository at this point in the history
  • Loading branch information
Youssef1313 committed Jul 11, 2024
1 parent d188320 commit e51b2a1
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
using Microsoft.UI.Xaml.Controls.Primitives;
using Microsoft.UI.Xaml.Data;
using Microsoft.UI.Xaml.Media.Imaging;
using Microsoft.UI.Dispatching;

namespace Microsoft.UI.Xaml.Controls
{
Expand Down Expand Up @@ -262,7 +263,10 @@ private static void OnReorderCompleted(object sender, _DragEventArgs dragEventAr

that.m_tpPrimaryDraggedContainer = null;

that.ChangeSelectorItemsVisualState(true);
// CompleteReordering will remove the children and add them back on next measure.
// We defer ChangeSelectorItemsVisualState to the next measure so that the children are there and updated.
// An alternative could be to retrieve the children before CompleteReordering and then update the visual state here.
that.DispatcherQueue.TryEnqueue(DispatcherQueuePriority.Low, () => that.ChangeSelectorItemsVisualState(true));

if (that.IsGrouping
|| !updatedIndex.HasValue
Expand Down

0 comments on commit e51b2a1

Please sign in to comment.