Skip to content

GridView is much slower than ListBox/ListView #132

Description

@f-shake

Firstly thanksfor this gui library, it is very beautiful.

When I Use Gridview to show thousands of files like file explorer in windows, it has bad performance. The flowwing is my codes:

 <m:GridView     x:Name="lbxGrdFiles" ContextMenu="{StaticResource menu}"
                      PreviewMouseDoubleClick="lvwFiles_PreviewMouseDoubleClick" 
                         ItemsSource="{Binding Path=PagingFiles}" >
                <ListBox.ItemTemplate>
                    <DataTemplate >
                        ...
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </m:GridView>

The app need about ten seconds to load layouts. Thus I have to page Files (120 files/page), but it is still cost about 1s to load.
I use ListView with same ItemsSource, it load quickly that less than 0.5s. These are my codes with ListView:

 <ListView   ItemsSource="{Binding Files}" x:Name="lvwFiles" SelectionMode="Extended"
                    Loaded="lvwFiles_Loaded"  PreviewMouseDoubleClick="lvwFiles_PreviewMouseDoubleClick"  ContextMenu="{StaticResource menu}"   >
                <ListView.ItemContainerStyle >
                    <Style TargetType="ListViewItem">
                        <Setter Property="HorizontalContentAlignment" Value="Stretch" />
                    </Style>
                </ListView.ItemContainerStyle>
                <ListView.ItemTemplate>
                    <DataTemplate>
                    ...
                    </DataTemplate>
                </ListView.ItemTemplate>
            </ListView>

Maybe the GridView has no virtual list? I've tryed to add VirtualizingPanel.IsVirtualizing="True" to xaml, but it doesn't work.

You can see my source here

Is there any way to improve its performence?
thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions