Drag and Drop across second root node has args.OriginalSource incorrect value #7266
Closed
1 of 2 tasks
Labels
bug
Something isn't working
no-issue-activity
product-winui3
WinUI 3 issues
team-Rendering
Issue for the Rendering team
Describe the bug
The attached sample replicate an issue in which we're unable to block a drag and drop operation on a TreeView involving two roots. Nodes under the first root should only be allowed to drop under the first root.
When dragging a TreeViewItem below the first root node across the second root node, OnDragEnter is passed as both sender and args.OriginalSource containing the second root node. In other words, args.OriginalSource is no longer the node we started dragging.
Steps to reproduce the bug
The node will report as invalid for the drop using the attempted edits, but the drop will proceed anyway.
TreeViewDragAndDrop.zip
Expected behavior
Nodes dragged over which report as invalid are allowed to drop even though marked has Handled.
Screenshots
No response
NuGet package version
No response
Windows app type
Device form factor
Desktop
Windows version
Windows 11 (22H2): Build 22621
Additional context
We are also uncertain as to what effect calling base.OnDragEnter(args) has, if any, although it's referred to in the UIElement.OnDragEnter documentation.
A clear and concise example of drag and drop relating to TreeView would be very useful.
The text was updated successfully, but these errors were encountered: