-
Notifications
You must be signed in to change notification settings - Fork 706
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
Fix issue with single select and unrealized children on TreeView #2547
Fix issue with single select and unrealized children on TreeView #2547
Conversation
@@ -1040,7 +1040,12 @@ void ViewModel::SelectedNodeChildrenChanged(winrt::TreeViewNode const& sender, w | |||
case (winrt::CollectionChange::ItemInserted): | |||
{ | |||
auto newNode = changingChildrenNode.Children().GetAt(index); | |||
UpdateNodeSelection(newNode, NodeSelectionState(changingChildrenNode)); | |||
|
|||
// If we are in multi select, we want the new child items to be also selected. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// If we are in multi select, we want the new child items to be also selected. [](start = 8, length = 78)
I assume that the desired behavior is not dependent on the 'HasUnrealizedChildren' flag. That is, when all the children are realized and we expand a node we would behave the same.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@chingucoding do you know if this is the case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I know this method would handle both cases regardless of the HasUnrealizedChildren flag. This listener just acts when the children of the selected node have changed. However in the case of HasUnrealizedChildren, those children got added to the selected item, raising this listener. Since in SingleSelect, selecting an item unselects the previous item, this resulted in the faulty behavior.
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
@chingucoding looks like there is a merge conflict now :/ |
Merge conflict should be resolved now. Thanks for the ping! |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
* Add test page * Add test * Fix the issue * Clean up tests * Remove empty line
Description
When a selected item is being expanded and it is using virtualization (i.e.
HasUnrealizedChildren
), the items will get set to "selected". This is wanted in multi select, however in single select this moves the selection, which is not the intended behavior.This get's fixed by only updating the child item's selection when we are in multi select.
Motivation and Context
Fixes #1820 , Fixes #2463
How Has This Been Tested?
Add new interaction test.
Screenshots (if appropriate):