[NumberBox, fix proposed] Initially collapsed number boxes will never show spin buttons
See original GitHub issueDescribe the bug
NumberBox that was created in Collapsed state and then made Visible - will never show spin buttons. For example, for Page that adapts to window size it could be useful to create two NumberBox, visible and invisible, bound to the same property, and do something like this:
<VisualState.StateTriggers>
<AdaptiveTrigger MinWindowWidth="{StaticResource MinWindowSnapPoint}" />
</VisualState.StateTriggers>
<VisualState.Setters>
<Setter Target="RightPane.Visibility" Value="Collapsed"/>
<Setter Target="BottomPane.Visibility" Value="Visible"/>
</VisualState.Setters>
it’s enough to provoke bug.
Steps to reproduce the bug
- New C++ Blank project, add to MainPage.xaml such code:
<StackPanel Spacing="8">
<CheckBox x:Name="checkBox" Content="Show NumberBox" IsChecked="True"/>
<muxc:NumberBox SpinButtonPlacementMode="Inline" Value="123" Header="This NumberBox was Visible initial part of lifetime, buttons are here" Visibility="{Binding IsChecked, ElementName=checkBox}"/>
<muxc:NumberBox SpinButtonPlacementMode="Inline" Value="456" Header="This NumberBox was Collapsed initial part of lifetime, buttons are lost" Visibility="{Binding IsChecked, ElementName=checkBox, FallbackValue=Collapsed}"/>
</StackPanel>
- Run
Expected behavior
Both NumberBox-es should have spin buttons
Screenshots
NuGet package version
Microsoft.UI.Xaml 2.7.0
Windows app type
- UWP
- Win32
Device form factor
No response
Windows version
Insider Build (xxxxx)
Additional context
Windows 11.0.22000, WinUI 2.7
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
Use UpDown Button (Spin Button) in WinUI NumberBox
Learn here all about how to use UpDown Button (SpinButton) in Syncfusion WinUI ... can be used to hide or show the visibility...
Read more >Can I hide the HTML5 number input's spin box?
Try using input type="tel" instead. It pops up a keyboard with numbers, and it doesn't show spin boxes. It requires no JavaScript or...
Read more >NumberBoxSpinButtonPlacemen...
The spin buttons are not displayed. The spin buttons are displayed in an expanded, horizontal orientation.
Read more >PeopleTools 8.55: Applications User's Guide
No other rights are granted to the U.S. Government. ... To reorder favorites, type an appropriate number in the Sequence number box. 2....
Read more >Version 5 - 5.21.2 Release Notes
Decisions 5 is a major release that is a face lift to the End User Portal and the designers. The primary focus of...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The reason is obvious - NumberBox::UpdateSpinButtonPlacement() is not called in NumberBox::OnApplyTemplate(), and for initially collapsed NumberBox template is applied very late, only when NumberBox became visible. Will prepare pull request with the fix.
🎉This issue was addressed in #6053, which has now been successfully released as
Microsoft.UI.Xaml v2.8.2
.🎉Handy links: