microsoft / microsoft/microsoft-ui-xaml
SelectorBar renders nothing if the first SelectorBarItem.Visibility is set to "Collapsed"
- Dominant language
- C++
- Stars
- 8.4k
- Forks
- 942
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 105
Description
### Describe the bug
Under some circumstances, setting the Visibility of the first SelectorBarItem in a SelectorBar to Collapsed via XAML causes the whole bar to stop rendering. Setting any other item to collapsed is fine, and skips over that item as one would expect.
There seem to be certain ways of setting the visiblity that don't trigger this, which I don't quite understand:
* Setting it directly in XAML, e.g. `` triggers it
* Modifying it via a VisualState Setter, e.g. `` triggers it
* Setting Visiblity to a bound value, e.g. `` or `...Visibility="{Binding ...}"` doesn't trigger it
* Setting it directly from the code-behind, e.g. `MyBarItem.Visibility = Visibility.Collapsed` doesn't trigger it
### Steps to reproduce the bug
This can be reproduced in the scratchpad of the WinUI 3 Gallery
The following code shows nothing:
```
```
This shows the expected bar with the 'Cut' icon skipped:
```
```
### Expected behavior
_No response_
### Screenshots

Scratch pad showing the bug

Scratch pad showing correct behaviour
### NuGet package version
WinUI 3 - Windows App SDK 1.7.2: 1.7.250513003
### Windows version
Windows 11 (24H2): Build 26100
### Additional context
_No response_
Contributor guide
Research direction
Start by reproducing the issue in the WinUI 3 Gallery scratchpad using the provided SelectorBar XAML, then compare a first item collapsed through XAML or a VisualState Setter with the binding and code-behind cases. Done means the SelectorBar renders its remaining items when the first SelectorBarItem is collapsed, without regressing the other visibility behaviors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- desktop, frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100