punker76 / gong-wpf-dragdrop

The GongSolutions.WPF.DragDrop library is a drag'n'drop framework for WPF
BSD 3-Clause "New" or "Revised" License
2.28k stars 400 forks source link

Highlight/Select dropped (custom way) ListBox item. 🔥 #492

Open AlexandruFilipescuGuehring opened 6 months ago

AlexandruFilipescuGuehring commented 6 months ago

Describe the bug I have some trouble with selecting an ListBox item after it is dropped from a ListBox to a ListBox wrapped in a canvas. `

   </ItemsPanelTemplate> 

`

I noticed that if the property is placed in the XAML View like dd:DragDrop.SelectDroppedItems="True" and I remove the dd:DragDrop.DropHandler="{Binding}" it partially works. But the ListBox is not correctly positioned but selected. To correctly position a ListBox in my canvas I have a Drop() function that takes care of the positioning but doesn't select the item.

Couldn't I get the same behavior in my C# code as = dd:DragDrop.SelectDroppedItems="True" does in the XAML by adding it somewhere in my ViewModel, Drop() function? I think that there is some conflict with the custom functionality of the ListBox.

I have been stuck for days and I don't know what to do... Thanks for your time.

Expected behavior I want an item to be directly highlighted with that blue border around it after it is dropped on the Canvas.

Desktop (please complete the following information):

  • OS: Windows
  • Version 11