locked
ListView Oddity - Windows Store App

    Question

  • Dear All,

    I am developing an universal app and using a ListView to display more than 50000 entries. I am using the following method to load the data:

    1. In the assets folder there's a simple utf-8 txt file with all the items (headwords of a dictionary in alphabetical order just to be precise).

    2. I load the file into an IList with ReadLinesAsync:

    IList<string> lista1 = await FileIO.ReadLinesAsync(listafile1);

    3. Finally I set the ItemsSource of the ListView to this IList:

    listView1.ItemsSource = lista1;

    It seems to be fast and work fine but at the end of the list the items are disappearing after scrolling.  I experience this on phones and pc and even in the emulator. I made a video of it but couldn't embed til msdn verified my account, so here it is: https://onedrive.live.com/?cid=8FB033BDA1E13D3A&id=8FB033BDA1E13D3A%21316&v=3

    I already created the same app for android and ios without any errors.

    I would appreciate any help

    István




    • Edited by MileIAk Wednesday, July 30, 2014 2:37 PM
    Wednesday, July 30, 2014 2:23 PM

Answers

  • Hi.

    Do you set ListView.ItemsSource once?

    Also, try to add VirtualizingStackPanel to your ListView in xaml:

                <ListView>
                    <ListView.ItemsPanel>
                        <ItemsPanelTemplate>
                            <VirtualizingStackPanel/>
                        </ItemsPanelTemplate>
                    </ListView.ItemsPanel>
                </ListView>

    • Marked as answer by MileIAk Thursday, July 31, 2014 1:51 PM
    Thursday, July 31, 2014 11:51 AM

All replies

  • Hi MilelAk,

    the link you've provided is no more available.


    Thomas Claudius Huber

    "If you can't make your app run faster, make it at least look & feel extremly fast"

    My latest Pluralsight-course: Windows Store Apps - Data Binding in Depth

    twitter: @thomasclaudiush
    homepage: www.thomasclaudiushuber.com
    author of: ultimate Windows Store Apps handbook | ultimate WPF handbook | ultimate Silverlight handbook

    Wednesday, July 30, 2014 8:42 PM
  • Hi!

    Can you try this one: http://goo.gl/YYrm5W

    • Edited by MileIAk Wednesday, July 30, 2014 9:28 PM
    Wednesday, July 30, 2014 9:24 PM
  • Hi,

    The link you provide also cannot open.

    Best Wishes!


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. <br/> Click <a href="http://support.microsoft.com/common/survey.aspx?showpage=1&scid=sw%3Ben%3B3559&theme=tech"> HERE</a> to participate the survey.

    Thursday, July 31, 2014 3:10 AM
  • Maybe something's wrong with onedrive. I'll try google drive: http://goo.gl/zUraeV

    • Edited by MileIAk Thursday, July 31, 2014 11:53 AM
    Thursday, July 31, 2014 11:24 AM
  • Hi.

    Do you set ListView.ItemsSource once?

    Also, try to add VirtualizingStackPanel to your ListView in xaml:

                <ListView>
                    <ListView.ItemsPanel>
                        <ItemsPanelTemplate>
                            <VirtualizingStackPanel/>
                        </ItemsPanelTemplate>
                    </ListView.ItemsPanel>
                </ListView>

    • Marked as answer by MileIAk Thursday, July 31, 2014 1:51 PM
    Thursday, July 31, 2014 11:51 AM
  • Thank you. No, sometimes I reset the ItemsSource. Shouldn't I do it? I can use more than one ListView and switch their visibility if that's better. I'll try the VirtualizingStackPanel, thank you.


    • Edited by MileIAk Thursday, July 31, 2014 1:29 PM
    Thursday, July 31, 2014 12:06 PM
  • Thank you very much, I tried it and the items are showing!

    • Edited by MileIAk Thursday, July 31, 2014 1:49 PM
    Thursday, July 31, 2014 12:41 PM