Layout cycle detected. Layout could not complete. Layout cycle detected. Layout could not complete

前端 未结 2 852
攒了一身酷
攒了一身酷 2021-01-16 12:24

I know there are some questions with same head line, but I couldn\'t find any answer that worked for me.

Got in Xml file triple ListBox , which was built from 3 inne

相关标签:
2条回答
  • 2021-01-16 13:00

    I used the ListBox built-in ScrollViewer instead of ScrollViewer layout and it seems to fix the bug.

    <ListBox x:Name="RegistersListView" ItemsSource="{x:Bind registersList}" Grid.Row="1" 
                 ScrollViewer.HorizontalScrollBarVisibility="Visible" ScrollViewer.HorizontalScrollMode="Enabled">
    

    Performance still not good for more than 50 objects, but this is better than exception. When using ListView instead of ListBox performance is better but the built-in ScrollViewer is not shown. So I don't mark this answer as acceptable.

    The ListView version:

    <ListView x:Name="RegistersListView" ItemsSource="{x:Bind registersList}" Grid.Row="1"
                 ScrollViewer.HorizontalScrollBarVisibility="Visible" ScrollViewer.HorizontalScrollMode="Enabled"
    
    0 讨论(0)
  • 2021-01-16 13:00

    I had a few StackLayouts populated via foreach loops. They were each contained within a ScrollViewer of fixed height.

    When the content was too great, it started to crash with the obscure 'layout cycle detected' error..

    I changed the StackLayouts to Grids, and finally this extremely annoying problem was solved.

    Update: 1 year later my application suffered from the problem again. I fixed it by adding a VerticalAlignment property to the offending Grid view...

    0 讨论(0)
提交回复
热议问题