Skip to content

Library throws "The specified Visual is not an ancestor of this Visual" #146

@DominikPalo

Description

@DominikPalo

I'm using your library (version 1.0.0-ALPHA011) for ordering and moving items beetween ListViews and sometimes an exception "The specified Visual is not an ancestor of this Visual" is thrown. It happens randomly (~10-20% of drag&drops).

Update: it happens only with ListView items which contains in their DataTemplate a nested ListView and I start dragging by clicking on the item from a nested ListView (also after item is dropped, an item from dropped item's nested listview is moved out from parent item... but nested ListView has not allowed drag&drop functionaliy -> IsDragSource is set to false and drag adorner shows entire item with nested ListView while dragging)

Stack trace:

   at System.Windows.Media.Visual.TrySimpleTransformToAncestor(Visual ancestor, Boolean inverse, GeneralTransform& generalTransform, Matrix& simpleTransform)
   at System.Windows.Media.Visual.TransformToAncestor(Visual ancestor)
   at GongSolutions.Wpf.DragDrop.Utilities.ItemsControlExtensions.GetClosest(ItemsControl itemsControl, List`1 items, Point position, Orientation searchDirection) in d:\projects\git\gong-wpf-dragdrop\GongSolutions.Wpf.DragDrop\Utilities\ItemsControlExtensions.cs:line 361
   at GongSolutions.Wpf.DragDrop.Utilities.ItemsControlExtensions.GetItemContainerAt(ItemsControl itemsControl, Point position, Orientation searchDirection) in d:\projects\git\gong-wpf-dragdrop\GongSolutions.Wpf.DragDrop\Utilities\ItemsControlExtensions.cs:line 134
   at GongSolutions.Wpf.DragDrop.DropInfo..ctor(Object sender, DragEventArgs e, DragInfo dragInfo) in d:\projects\git\gong-wpf-dragdrop\GongSolutions.Wpf.DragDrop\DropInfo.cs:line 78
   at GongSolutions.Wpf.DragDrop.DragDrop.DropTarget_PreviewDragOver(Object sender, DragEventArgs e) in d:\projects\git\gong-wpf-dragdrop\GongSolutions.Wpf.DragDrop\DragDrop.cs:line 845
   at GongSolutions.Wpf.DragDrop.DragDrop.DropTarget_PreviewDragEnter(Object sender, DragEventArgs e) in d:\projects\git\gong-wpf-dragdrop\GongSolutions.Wpf.DragDrop\DragDrop.cs:line 820
   at System.Windows.DragEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
   at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
   at System.Windows.ContentElement.RaiseEvent(RoutedEventArgs e)
   at System.Windows.OleDropTarget.RaiseDragEvent(RoutedEvent dragEvent, Int32 dragDropKeyStates, Int32& effects, DependencyObject target, Point targetPoint)
   at System.Windows.OleDropTarget.MS.Win32.UnsafeNativeMethods.IOleDropTarget.OleDragOver(Int32 dragDropKeyStates, Int64 point, Int32& effects)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions