locked
ItemRealized/ItemUnRealized for ListView/GridView

    Question

  • Hi All,

    I have used ItemRealized/ItemUnRealized in Windows Phone 8 LongListMultiSelector control to load the current viewing images.

    But In Windows Store apps ListView/GridView don't have those events.

    Here my requirement:

    I have to show 2000+ images. My viewport contains only 4x5=20 images. So When user scroll to down directly to bottom, I want to download the bottom images first(which are in currently in view). But the converter is called for 2000+ images and it is started downloading for all 2000+ images, So my last 20 images are downloading after all images.

    If ListView/GridView has somthing like ItemRealized/ItemUnRealized, I will copy same existing code in Store app.

    Thanks,


    Pallam Madhukar Windows Phone Developer

    Monday, December 22, 2014 2:35 PM

Answers

  • I've used a technique that counts the number of references to my OnPropertyChanged method.  On a transition from nobody collecting that event to someone collecting it, I can queue for download.  On a transition from someone listening to nobody listening, if the item is in the download queue, remove it.  If it isn't in the queue, no worries - it's already downloaded and I don't have to do anything.

    ... of course you'll have to implement a download queue for images to do this.  I used something like a LowProfileImageLoader for my download queue.


    Darin R.

    Wednesday, December 31, 2014 5:12 PM

All replies

  • There is no such features in ListView and GridView. ItemsCotnrol in store app supports Data Virtualization, please check it out. http://msdn.microsoft.com/en-us/library/windows/apps/xaml/hh780657.aspx. I think you can use Incremental virtualization to work around.

    Tuesday, December 23, 2014 8:35 AM
  • Hi Avatar002,

    I checked the Incremental virtualization, but I have 2000+ images in Sqlite database. and database will return 2000+ records immedetly. 

    I need to show all the images at a time. & user should able to scroll fastly. and  when user stopped scrolling it should display the current viewport images. That is not possible with "Incremental virtualization". 

    If you have any idea to implement the above logic, please tell me, I will try.

    Thanks


    Pallam Madhukar Windows Phone Developer


    Tuesday, December 23, 2014 9:29 AM
  • Hi Pallam,

    Listview support data virtualization by default. You just need to provide an object array as ListView data source.

    ListView supports data virtualization to improve performance with large data sets. Random access virtualization is supported when the data source implements the appropriate interfaces, which vary depending on the programming language:

    • C++/CX apps should implement IObservableVector.
    • C# or Visual Basic apps should implement INotifyCollectionChanged and System.Collections.IList (not IList<T>). Virtualization requires both of these interfaces.

    What you need to do is to prepare an array implement INotifyCollectionChanged and IList interfaces. You can find more information about this from the following link. http://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.controls.listview.aspx. See them in remark section.

    Please have a look at ObservableCollection<T> class, you can use it to support data virtualization.

    Regards,


    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. Click HERE to participate the survey.

    Wednesday, December 31, 2014 2:38 AM
    Moderator
  • I've used a technique that counts the number of references to my OnPropertyChanged method.  On a transition from nobody collecting that event to someone collecting it, I can queue for download.  On a transition from someone listening to nobody listening, if the item is in the download queue, remove it.  If it isn't in the queue, no worries - it's already downloaded and I don't have to do anything.

    ... of course you'll have to implement a download queue for images to do this.  I used something like a LowProfileImageLoader for my download queue.


    Darin R.

    Wednesday, December 31, 2014 5:12 PM