afr0
afr0

Reputation: 888

WinRT XAML ScrollViewer/ListView rendering huge list doesn't work on device

Starting with following code

<Grid>
    <ScrollViewer>
        <ListView Name="listview" ItemsSource="{Binding Source={StaticResource list}}" />                   
    </ScrollViewer>
</Grid>

I've huge list for winrt app around 1k items. it takes too much time to scroll so I've implemented scroll to top and bottom functionality.

listview.SelectedIndex 
listview.UpdateLayout();
listview.ScrollIntoView(SelectedItem);

All this works fine on a simulator having around 1000 items in the ListView. but when I run the app with Surface device this method doesn't work. It actually fails and paints black rectangles while trying to render ListView.

I've just wasted my two days on it. I tried many things but no luck. Can someone tell me how can I handle long list using ScrollViewer having a ListView and using MVVM on Surface device itself. Simply put smooth scrolling on Surface device with a list of beyond 1000 while moving start to end programmatically.

PS: implementing search is not the option.

Upvotes: 0

Views: 153

Answers (1)

Filip Skakun
Filip Skakun

Reputation: 31724

You should remove the outer ScrollViewer because that breaks virtualization. Other than that there's a limit on the size of the panels you can scroll to about 2 million pixels high/wide. After that you will see rendering issues.

The only way around that is rather complicated and involves writing your own list control from scratch. I don't think anyone has done it yet. Usually if the data is too big - people use other strategies like grouping and expanding groups.

Upvotes: 1

Related Questions