microsoft / microsoft/microsoft-ui-xaml
TreeViewItem.IsExpanded in WindowsAppSDK 1.6/1.7/1.8 behaves inconsistently when repopulating the TreeView
- Dominant language
- C++
- Stars
- 8.4k
- Forks
- 942
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 105
Description
### Describe the bug
When using TreeView's item template and setting TreeViewItem.IsExpanded to True in XAML, repopulating (clearing item and then adding new items) the tree a few times collapses all items.
When binding TreeViewItem.IsExpanded to a read-only property set to True, repopulating the tree randomly collapses/expands the items.
1.5 doesn't have this issue.
### Steps to reproduce the bug
A project that demonstrates the bug: https://github.com/usakgb/WinUITreeViewBug
1. Clone and run the project.
2. Click Repopulate button a few times.
### Expected behavior
All items to be expanded at all times.
### Screenshots

### NuGet package version
Windows App SDK 1.6.3: 1.6.241114003
### Packaging type
Packaged (MSIX)
### Windows version
Windows 11 version 22H2 (22621, 2022 Update)
### IDE
Visual Studio 2022
### Additional context
_No response_
Contributor guide
Research direction
Clone the linked WinUITreeViewBug project and run it with Windows App SDK 1.6.3 on Windows 11. Click Repopulate repeatedly while observing TreeViewItem.IsExpanded, then compare the behavior with Windows App SDK 1.5. Done means identifying and fixing the regression so repopulating consistently leaves all items expanded, including the XAML and read-only binding cases.
Written by the indexing model from the issue text.
Assessment
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100