Repository navigation
Fix brief deselection of selected item to be selected when changing selected item. - #379
Conversation
* Updated SetSelectedItem() method in ItemsControlExtensions to not deselect the item we're selecting before before selecting it again.
|
Although I myself am working with Also, I've not updated the The original issue (#21) would only have occurred for scenarios where multiple items are selected. I therefore suspect that that line could probably be outright removed, and will update this pull request with that change if a maintainer agrees. |
|
@Metritutus your changes have been merged, thanks for your contribution 👍 |
|
@Metritutus Yes, I think we don't need that, so I commented this out. |
|
@punker76 Ah sorry, I missed that you'd made alterations after the merge! |
In the
SetSelectedItem()method ofItemsControlExtensions, it sets theSelectedItemtonullbefore setting it to the value passed in. For an existing multi-selection, the value being selected could already be within that existing selection, meaning that the item we wish to select is being deselected and then selected again.This behaviour can make
SelectionChangedevent handling somewhat problematic further down the line (an application I'm working manages what selection behaviour in theSelectionChangedevents for nestedDataGrid instances, and the deselection of all rows, followed by the selection of the correct one for the parentDataGridhad implications for the childDataGrid` instance's selected rows. This relates to the other pull request I've raised, #378).What changed?
The original change (df10543) to set the
SelectedItemtonullfirst before setting it to the new value was made to resolve issue #21. The change made in this pull request does not regress that issue.