1

I have a large list of items, so i should request corresponding page from the server. How to catch an event, when user scrolls to the end of the listbox, so i can request another page?

Den
  • 16,686
  • 4
  • 47
  • 87
Vitalii Vasylenko
  • 4,776
  • 5
  • 40
  • 64

4 Answers4

2

The exact solutions you are looking for: http://danielvaughan.orpius.com/post/Scroll-Based-Data-Loading-in-Windows-Phone-7.aspx

Alius
  • 66
  • 6
1

You're thinking about data virtualization. Shawn Oster wrote a really good explanation to this here. To sum it up, it's not the ListBox that is managing your data, but your custom IList implementation, that is able to fetch new items each time a new data chunk is needed.

Den
  • 16,686
  • 4
  • 47
  • 87
0

you can just check the vertical offset if is greater than the scrollable height, the user is at the bottom of the list, fire the request for another page as needed.

0

The best approach is to use the LongListSelector. It's available from the Windows Phone Toolkit for Windows Phone 7 or it's built-in on Windows Phone 8. It performs better than the built-in ListBox and has more features.

A post from the official Windows Phone Developer blog (from October 2012) gives all the details and tells how to setup infinite scrolling.

Neil Turner
  • 2,712
  • 2
  • 18
  • 37
  • 1
    It performs better until you have complex datatemplates with nested lists producing a UI similar to Stack Overflow. Then it throws a LayoutCycleException when you insert or remove an item that triggers a layout cycle. Reverting to ListBox made all my nightmares vanish like the morning mist. – Peter Wone Feb 11 '14 at 21:35