I would like to have your advise with ListView in a WinUI 3 project (Desktop).
I have a search box where the user can enter keywords and according to them, the results are displayed in a listview.
The listview can contain 0 to more than 10000 entries to display. When the number of items to display is very large, the listview can take more than 6 sec to display the results.
I wonder why it takes so long when the listview handles data virtualization (as if the listview renders all results even though they are not displayed)
I found the following articles in which the authors talk about lazy loading:
https://platform.uno/blog/lazy-loading-functionality-uno-wasm/
Do you think it is necessary to implement this type of operation when you know that the number of results can be high or am I using the listview wrong?
I use the following code to declare my listview:
<CollectionViewSource x:Name="SearchViewResults"
Source="{x:Bind ViewModel.ResultItems}"
IsSourceGrouped="True" />
<ListView x:Name="SearchListResults"
ItemsSource="{x:Bind SearchViewResults.View, Mode=OneWay}"
ItemTemplate="{StaticResource RowResultTemplate}"
SelectedIndex="{x:Bind ViewModel.SelectedIndex, Mode=TwoWay}"
SelectedItem="{x:Bind ViewModel.SelectedItem, Mode=TwoWay}"
Visibility="{x:Bind ViewModel.ResultsViewVisibility, Mode=TwoWay}"
Margin="4,0"
Height="{x:Bind ViewModel.SearchListResultsHeight, Mode=TwoWay}"
MinWidth="800"
SelectionChanged="SearchListResults_SelectionChanged"
IsItemClickEnabled="True"
ItemClick="SearchListResults_ItemClick"
AllowFocusOnInteraction="False">
<ListView.ItemsPanel>
<ItemsPanelTemplate>
<ItemsStackPanel AreStickyGroupHeadersEnabled="True" />
</ItemsPanelTemplate>
</ListView.ItemsPanel>
</ListView>
Thank you for your help