CommunityToolkit / WindowsCommunityToolkit

The Windows Community Toolkit is a collection of helpers, extensions, and custom controls. It simplifies and demonstrates common developer tasks building .NET apps with UWP and the Windows App SDK / WinUI 3 for Windows 10 and Windows 11. The toolkit is part of the .NET Foundation.
https://docs.microsoft.com/windows/communitytoolkit/
Other
5.83k stars 1.37k forks source link

RangeSelector breaking WinUI 3.0 when setting Minimum/Maximum via code to the same value #4110

Open stephtr opened 3 years ago

stephtr commented 3 years ago

Describe the bug

When programatically setting a RangeSelector's Minimum and Maximum property to the same value, the app's UI breaks and partially doesn't respond to user actions (like hovering over a button). This behaviour was either introduced by Community.Toolkit.WinUI.UI.Controls v7.0.3 (not present in v7.0.2) or Project reunion 0.8.0 (not present in 0.5.6).

Steps to Reproduce

Steps to reproduce the behavior:

  1. Create a new WinUI 3 Desktop app (Project reunion 0.8.1, Community.Toolkit.WinUI.UI.Controls 7.0.3)
  2. Add the following code:
    <StackPanel>
    <Button Margin="20" Content="Hello world" />
    <controls:RangeSelector x:Name="rng" Margin="20" HorizontalAlignment="Stretch" />
    <ToggleSwitch Toggled="ToggleSwitch_Toggled" />
    </StackPanel>
private void ToggleSwitch_Toggled(object sender, RoutedEventArgs e)
{
    rng.Minimum = 1;
    rng.Maximum = 1;
}

Expected behavior

After toggling the switch, the UI should still work. Instead, the RangeSelector loses its handles and the button doesn't respond to mouse events but needs to be reactivated via the keyboard's Tab.

Screenshots

image

Environment

NuGet Package(s):
CommunityToolkit.WinUI.UI.Controls 7.0.3
Microsoft.ProjectReunion 0.8.1

Package Version(s):

Windows 10 Build Number:
- [ ] Fall Creators Update (16299)
- [ ] April 2018 Update (17134)
- [ ] October 2018 Update (17763)
- [ ] May 2019 Update (18362)
- [x] May 2020 Update (19041)
- [x] Insider Build (build number: 22000.65)

App min and target version:
- [ ] Fall Creators Update (16299)
- [ ] April 2018 Update (17134)
- [x] October 2018 Update (17763) MIN
- [ ] May 2019 Update (18362)
- [x] May 2020 Update (19041) TARGET
- [ ] Insider Build (xxxxx)

Device form factor:
- [x] Desktop
- [ ] Xbox
- [ ] Surface Hub
- [ ] IoT

Visual Studio
- [ ] 2017 (version: )
- [ ] 2019 (version: )
- [x] 2019 Preview (version: 16.11.0 preview 1.0)

Additional context

ghost commented 3 years ago

Hello stephtr, thank you for opening an issue with us!

I have automatically added a "needs triage" label to help get things started. Our team will analyze and investigate the issue, and escalate it to the relevant team if possible. Other community members may also look into the issue and provide feedback 🙌