-
-
Notifications
You must be signed in to change notification settings - Fork 405
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Item selection in ItemsControl is not handled on PreviewMouseLeftButtonUp when multiple selection is enabled #336
Comments
@punker76 Am I correct that all that needs to be done is to update line Specifically changing this:
To this: if (dragInfo?.VisualSource is ItemsControl itemsControl && _clickSupressItem != null && _clickSupressItem == dragInfo.SourceItem) I've tried to fix this issue because I've been working with drag-and-drop and multi-selection with WPF data grids, and found that:
In testing the above change, everything seems to work fine, however as I am not fully familiar with the code it's always possible that I've overlooked something important. If you think this change is fine then I'll happily submit a pull-request with this change , assuming this project is not dead (which would be a shame), as I see that the last commit was in November 2020, and there are pending pull requests dating back years. |
Fix nested ItemsControl behaviour issues highlighted in issue #336
…rol) when multiple/extended selection is enabled
Steps to reproduce
Example
Expected behavior
"Reset" the selection to the already selected item in the ListBox only (e.g: de-select the other selected items).
Actual behavior
The selection does not change. The already selected items remain in that state until one item that is not selected is clicked or unless the user presses and holds the CTRL key and clicks on each item.
Findings
There exists a specific case in which the drag & drop is handled for ItemsControl elements. This occurs on PreviewMouseLeftButtonDown. However, PreviewMouseLeftButtonUp is not handled correctly.
I believe that the event PreviewMouseLeftButtonUp should be handled by the original element that set PreviewMouseLeftButtonDown's event to Handled = true.
gong-wpf-dragdrop/src/GongSolutions.WPF.DragDrop/DragDrop.cs
Lines 377 to 384 in bf73cb4
Environment
GongSolutions.WPF.DragDrop v2.x.x
Windows 10
Visual Studio 2019
.NET Framework 4.6
The text was updated successfully, but these errors were encountered: