Skip to content

Commit 37836c6

Browse files
[CmdPal] Fix Layout cycle detected. Layout could not complete (#38162)
<!-- Enter a brief description/summary of your PR here. What does it fix/what does it change/how was it tested (even manually, if necessary)? --> ## Summary of the Pull Request Attempt to fix `Layout cycle detected. Layout could not complete` exception when CmdPal is moved on a screen with different DPI. I can repro almost 100% and no longer occurs after switching tags `ItemsView` with `ItemsControl`. Doesn't seem to break visual and don't expect a huge number of tags so use an `ItemsControl` shouldn't be a problem. <img width="491" alt="image" src="https://github.com/user-attachments/assets/05b698b2-ebe7-4356-bdaa-4de93aea13e6" /> <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist - [ ] **Closes:** #xxx - [ ] **Communication:** I've discussed this with core contributors already. If work hasn't been agreed, this work might be rejected - [ ] **Tests:** Added/updated and all pass - [ ] **Localization:** All end user facing strings can be localized - [ ] **Dev docs:** Added/updated - [ ] **New binaries:** Added on the required places - [ ] [JSON for signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json) for new binaries - [ ] [WXS for installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs) for new binaries and localization folder - [ ] [YML for CI pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml) for new test projects - [ ] [YML for signed pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml) - [ ] **Documentation updated:** If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys) and link it here: #xxx <!-- Provide a more detailed description of the PR, other things fixed or any additional comments/features here --> ## Detailed Description of the Pull Request / Additional comments <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> ## Validation Steps Performed
1 parent 39e8231 commit 37836c6

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

src/modules/cmdpal/Microsoft.CmdPal.UI/ExtViews/ListPage.xaml

+8-10
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,6 @@
2727
EmptyValue="Collapsed"
2828
NotEmptyValue="Visible" />
2929

30-
<StackLayout
31-
x:Name="HorizontalStackLayout"
32-
Orientation="Horizontal"
33-
Spacing="4" />
34-
3530
<DataTemplate x:Key="TagTemplate" x:DataType="viewmodels:TagViewModel">
3631
<ItemContainer>
3732
<cpcontrols:Tag
@@ -86,19 +81,22 @@
8681
Visibility="{x:Bind Subtitle, Mode=OneWay, Converter={StaticResource StringVisibilityConverter}}" />
8782
</StackPanel>
8883

89-
<ItemsView
84+
<ItemsControl
9085
Grid.RowSpan="2"
9186
Grid.Column="2"
9287
Margin="0,0,8,0"
9388
VerticalAlignment="Center"
9489
IsHitTestVisible="False"
95-
IsItemInvokedEnabled="False"
9690
IsTabStop="False"
9791
ItemTemplate="{StaticResource TagTemplate}"
9892
ItemsSource="{x:Bind Tags, Mode=OneWay}"
99-
Layout="{StaticResource HorizontalStackLayout}"
100-
SelectionMode="None"
101-
Visibility="{x:Bind HasTags, Mode=OneWay}" />
93+
Visibility="{x:Bind HasTags, Mode=OneWay}">
94+
<ItemsControl.ItemsPanel>
95+
<ItemsPanelTemplate>
96+
<StackPanel Orientation="Horizontal" Spacing="4" />
97+
</ItemsPanelTemplate>
98+
</ItemsControl.ItemsPanel>
99+
</ItemsControl>
102100
</Grid>
103101
</DataTemplate>
104102
</Page.Resources>

0 commit comments

Comments
 (0)