question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[NumberBox, fix proposed] Initially collapsed number boxes will never show spin buttons

See original GitHub issue

Describe 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

  1. 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>
  1. Run

Expected behavior

Both NumberBox-es should have spin buttons

Screenshots

image

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:closed
  • Created 2 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
eugenegffcommented, Oct 7, 2021

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.

0reactions
msftbot[bot]commented, Jan 3, 2023

🎉This issue was addressed in #6053, which has now been successfully released as Microsoft.UI.Xaml v2.8.2.🎉

Handy links:

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found