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

ItemsRepeater extremely slow #20

Open
Leon99 opened this issue Jul 31, 2023 · 7 comments
Open

ItemsRepeater extremely slow #20

Leon99 opened this issue Jul 31, 2023 · 7 comments
Labels
bug Something isn't working

Comments

@Leon99
Copy link

Leon99 commented Jul 31, 2023

Describe the bug
Even with ~20 items, ItemsRepeater takes a few seconds to scroll.

To Reproduce

    <DockPanel>
        <TextBox
            Name="SearchTextBox"
            Margin="15,5,15,10"
            Classes="clearButton"
            DockPanel.Dock="Top"
            Text="{Binding SearchTerm}"
            Watermark="Filter" />
        <ScrollViewer Padding="15,0">
            <ItemsRepeater ItemsSource="{Binding Types}">
                <ItemsRepeater.ItemTemplate>
                    <DataTemplate DataType="model:TypeExtract">
                        <controls:SettingsExpander
                            Margin="0,1"
                            Description="{Binding Namespace}"
                            Header="{Binding Name}" />
                    </DataTemplate>
                </ItemsRepeater.ItemTemplate>
            </ItemsRepeater>
        </ScrollViewer>
    </DockPanel>

Desktop (please complete the following information):

  • OS: Windows 11
  • Version 11.0.1

Additional context
Debug output constantly shows

[Layout]Layout cycle detected. Item 'Avalonia.Controls.StackPanel' was enqueued '10' times.(LayoutQueue`1 #12819582)
[Layout]Layout cycle detected. Item 'Avalonia.Controls.TextBlock' was enqueued '10' times.(LayoutQueue`1 #12819582)
[Layout]Layout cycle detected. Item 'Avalonia.Controls.Presenters.ContentPresenter' was enqueued '10' times.(LayoutQueue`1 #12819582)
@Leon99 Leon99 added the bug Something isn't working label Jul 31, 2023
@timunie
Copy link

timunie commented Jul 31, 2023

please attach or link a very minimal sample to reproduce. Thx.

@IanRawley
Copy link

IanRawley commented Aug 1, 2023

I've had something similar occur when two controls from two adjacent rows in the ItemsRepeater were touching. Specifically Buttons that took up the full height of their row. Try adding small margins to the outermost layout elements and see if that fixes the cycles.

Specifically the outermost layout elements of the controls:SettingsExpander

@timunie
Copy link

timunie commented Aug 1, 2023

@IanRawley interesting. Probably you can share a sample of your edge-case? Then we can investigate it further.

@Leon99
Copy link
Author

Leon99 commented Aug 1, 2023

Seems to be caused by FluentAvalonia.UI.Controls.NavigationView. Created amwx/FluentAvalonia#445 instead.

@IanRawley
Copy link

@IanRawley interesting. Probably you can share a sample of your edge-case? Then we can investigate it further.

Sorry, it was a while back and I don't have the code any more, or remember enough about the specifics to confidently reproduce it. It was also part of my first attempt at a custom control having just started using Avalonia, so no doubt there were many more issues contributing to it. I just remember that adding margins to a button in the datatemplate solved all my layout cycles.

@Leon99
Copy link
Author

Leon99 commented Aug 6, 2023

Hey @timunie, @amwx believes it's an Avalonia issue after all. Could you check it? I made a minimal repro.

@Leon99 Leon99 reopened this Aug 6, 2023
@timunie
Copy link

timunie commented Aug 7, 2023

minimal repro is in deed often useful. We can add it to samples/Sandbox and maybe debug it.

@maxkatz6 maxkatz6 transferred this issue from AvaloniaUI/Avalonia Mar 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants