You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
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 inDragSourceUp
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!
Beta Was this translation helpful? Give feedback.
All reactions