Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segmented - Layout Cycle at specific screen scaling #359

Closed
5 of 24 tasks
qhy040404 opened this issue Mar 6, 2024 · 0 comments · Fixed by #360
Closed
5 of 24 tasks

Segmented - Layout Cycle at specific screen scaling #359

qhy040404 opened this issue Mar 6, 2024 · 0 comments · Fixed by #360

Comments

@qhy040404
Copy link
Contributor

Describe the bug

Just simplify create a Segmented and add more than 1 item to it. Then set your screen scaling to 125% or 150% in System Settings. And you'll get crashed with LayoutCycleException.

<cwc:Segmented
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:cw="using:CommunityToolkit.WinUI"
    xmlns:cwc="using:CommunityToolkit.WinUI.Controls"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    Style="{StaticResource DefaultSegmentedStyle}"
    mc:Ignorable="d">
    <cwc:SegmentedItem Content="Test1" Icon="{cw:FontIcon Glyph=&#xEA3A;}"/>
    <cwc:SegmentedItem Content="Test2" Icon="{cw:FontIcon Glyph=&#xEA3A;}"/>
</cwc:Segmented>

Steps to reproduce

1. Set your screen scale to 125% or 150% or etc except 100%.
2. Create a new WinUI 3 project and paste the XAML sample from above as the content of the page.

Expected behavior

The Segmented correctly layout.

Screenshots

No response

Code Platform

  • UWP
  • WinAppSDK / WinUI 3
  • Web Assembly (WASM)
  • Android
  • iOS
  • MacOS
  • Linux / GTK

Windows Build Number

  • Windows 10 1809 (Build 17763)
  • Windows 10 1903 (Build 18362)
  • Windows 10 1909 (Build 18363)
  • Windows 10 2004 (Build 19041)
  • Windows 10 20H2 (Build 19042)
  • Windows 10 21H1 (Build 19043)
  • Windows 10 21H2 (Build 19044)
  • Windows 10 22H2 (Build 19045)
  • Windows 11 21H2 (Build 22000)
  • Other (specify)

Other Windows Build number

22621, 26058

App minimum and target SDK version

  • Windows 10, version 1809 (Build 17763)
  • Windows 10, version 1903 (Build 18362)
  • Windows 10, version 1909 (Build 18363)
  • Windows 10, version 2004 (Build 19041)
  • Windows 10, version 2104 (Build 20348)
  • Windows 11, version 22H2 (Build 22000)
  • Other (specify)

Other SDK version

minimum: 19045, target: 22621

Visual Studio Version

2022

Visual Studio Build Number

17.9.2

Device form factor

Desktop

Additional context

Through debugging information I found that in fact we are always struggling with a width difference of only 2. Usually at this point we already have a nearly perfect measured height, so we should just set the final width directly rather than re-measure.

Help us help you

Yes, I'd like to be assigned to work on this item.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

1 participant