Why DragLeave event is getting called for ListBox when we dragging the ListBoxItem within the ListBox.?
- Dominant language
- C#
- Stars
- 7.7k
- Forks
- 1.3k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 61
Description
* .NET Core Version: 3.0 Preview1
* Windows version: Windows 10
* Does the bug reproduce also in WPF for .NET Framework 4.8?: Yes
* Is this bug related specifically to tooling in Visual Studio (e.g. XAML Designer, Code editing, etc...)? No.
**Problem description:**
I have used the ListBox control which has the ListBoxItem and this ListBoxItem has a DragLeave event. And my ListBox also has a DragLeave event. My question is simple whenever I Drag and Drop the ListBoxItem within the ListBox the ListBoxItem DragLeave event getting called and the ListBox DragLeave event is also called. **Why DragLeave event is getting called for ListBox when we drag and drop the ListBoxItem within the ListBox.** Seems event is raised for both Listbox and ListboxItem. I expect that event should be raised only for ListboxItem. **Can you please confirm whether this is the behavior of DragAndDrop?**
**Note:** I have used the DragDrop.DoDragDrop() method to drop the Item
**Replication Procedure:**
1. Run the attached sample.
2. Then drag the "2" ListBoxItem and then Drop that into the "5".
3. And then open and see the output window.
4. You can see the Message "ListBox DragLeave event is called......"
**Actual behavior:**
DragLeave event is getting called for ListBox when we dragging the ListBoxItem within the ListBox.
**Expected behavior:**
ListBox DragLeave event is should be called when we dragging the ListBoxItem outside of the ListBox.
**Sample:** [WpfApp1.zip](https://github.com/dotnet/wpf/files/7038984/WpfApp1.zip)
Contributor guide
Assessment
This issue has not been assessed yet.