Skip to content
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

Multiselection problem #496

Open
jrscm opened this issue May 6, 2024 · 0 comments
Open

Multiselection problem #496

jrscm opened this issue May 6, 2024 · 0 comments
Labels

Comments

@jrscm
Copy link

jrscm commented May 6, 2024

Hello,

I am using this library (that I like a lot) with a DataGrid and I am experiencing a strange behaviour with multiselection, if I click on a selected item when more then one is selected, the selection change and only the item I clicked on remain selected.

Investigating in the code of DragDrop.cs I found this comment in the method DragSourceDown:
// If the sender is a list box that allows multiple selections, ensure that clicking on an // already selected item does not change the selection, otherwise dragging multiple items // is made impossible.
and the control is done with itemsControl.CanSelectMultipleItems() then in DragSourceUp there is condition to handle the multiselection
(Keyboard.Modifiers & ModifierKeys.Control) != 0 || itemsControl is ListBox listBox && listBox.SelectionMode == SelectionMode.Multiple
and since there is a check on the ListBox in my case with the DataGrid my multiselection is discarted.

I believe there is a mismatch in this two methods, either the multiselection is handled only for the ListBox or for every controls that satisfy CanSelectMultipleItems(), but the condition should be the same in both methods.
Anyway it is probably correct to handle it only for the ListBox since other ItemsControls could not need selection when items are clicked, in my case with the DataGrid I use checkboxes on row header and I don't want the selection to change by clicking on the DataGridCell of the items.

Does any of this make sense?
Let me know if something can be done to make this behaviour better.

Thanks!

@jrscm jrscm added the Bug label May 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant