I am using a listview similar to the following:
<ListView Margin="10" Name="myListView">
<ListView.ItemTemplate>
<DataTemplate>
<WrapPanel>
<TextBlock Text="Name: " />
<TextBlock Text="{Binding Name}" FontWeight="Bold" />
</WrapPanel>
</DataTemplate>
</ListView.ItemTemplate>
I am creating a listing of all files in a directory; a potentially very large number. The loading of the data-set is not in question here; I am preprocessing the data (loading from file, generating a temporary List<>, sorting, etc.) so IO performance is not an issue here.
With my prepopulated List<> object I then do a simple foreach and add:
private async Task AddItemsToList()
{
foreach(MyObject item in List<MyObject>)
{
myListView.Add(item)
}
}
The above is a mock up, however my code is the same.
When processing this foreach the UI does not update as each item is added. It is displayed as one large chunk once the foreach is complete. AddItemsToList() is not awaited.
I have read a few articles (particularly this) and am under the impression that UWP should automatically incrementally load and utilise placeholders.
Any suggestions would be much appreciated!
Andrew,
Note: I am aware UI Virtualisation would be ideal for excessive data sets (>10,000 items?) as described here.