locked
GridView / ListView limited Items display

    Question

  • Hello,

     I have a weird behavior of the GridView / ListView large lists in a simple page with a Grid or List View control of the winrt Windows Store app.

    On adding the 30 000 items with the only property say "Name" - all of the items are displayed. But setting the item template size to say - Width=400 Height=100 - only about half of the items are displayed - visible while navigating, at that navigation time while scrolling the items become visible, on scrolling stop - the items become invisible - the list view looks empty, on swiping the list - the consecutive items become visible again, and when the page stops - the items are not visible again!??? If you press and hold the finger on the list the items are visible, released - again invisible!!??

    Could anyone give some views on the matter,

    Thank you in advance

    Saturday, March 15, 2014 12:15 PM

All replies

  • That's a heck of a lot of items. Instead of loading them all at once use virtualization to load only the ones actually needed.
    Saturday, March 15, 2014 12:24 PM
    Owner
  • Additional info:

    public class Item { string Name {get;set;}

    List<Item> Items = new List<Item>();

    private void navigationHelper_LoadState(object sender, LoadStateEventArgs e)
    {
     Item item = null;
     for(int i = 0; i < 35000; i++)
     {
      item = new Item() { Name = "Title" + i};
      this.Items.Add(item);
     }
     this.DefaultViewModel["Items"] = Items;
    }

    ....

    Xaml GridView item Template with Width and Height

    <GridView.ItemTemplate>
     <DataTemplate>
      <Grid HorizontalAlignment="Left" Width="250" Height="250">
       <StackPanel VerticalAlignment="Bottom" Background="{ThemeResource ListViewItemOverlayBackgroundThemeBrush}">
        <TextBlock Text="{Binding Name}" Foreground="{ThemeResource ListViewItemOverlayForegroundThemeBrush}" Style="{StaticResource BaseTextBlockStyle}" Height="60" Margin="15,0,15,0" FontWeight="SemiBold"/>
       </StackPanel>
      </Grid>
     </DataTemplate>
    </GridView.ItemTemplate>

    Just 16 500 items are visible and normally scrollable, after this the items are not visible on the list if not srolling??!!

    Saturday, March 15, 2014 12:29 PM
  • Thank you Rob, for the reply.

    So it's too much, I thought of virtualization.. the strange thing is that when you press the list - those items are where, good visible, on stopping - they disappear...it would be not that misleading if the items would not be visible in both cases: normal (static view) and pressed or scrolled ?!

    Saturday, March 15, 2014 12:42 PM
  • I have the same problem. Any solution ?
    Wednesday, February 25, 2015 9:48 AM
  • Virtualization, or reduced item number, always filtered item list.
    Thursday, February 26, 2015 10:58 AM