Reputation: 53
I want to know is there any other solution of paging data on WindowsPhone Listbox control. I am used to paging data, by manually checking scrollbar position, and when it reaches the end of screen, then more data is loaded.
I want to ask, is there any other solution (better) of doing this (WP7 or WP8). My solution, which I've mentioned is connected with writing a lot of code (custom events, scroll listener, etc.) I think, there might be an easier solution, as WindowsPhone sdk 8.0 has been released...
Upvotes: 1
Views: 4893
Reputation: 1508
The key to WP8 infinite scrolling is LongListSelector control and handling the two events:
ItemRealized (loads item) and ItemUnrealized (removes item).
This events are raised automatically based on the detected static template size(height). It is a completely automatic, on-demand action. The engine "knows" when it should get the new item or remove the old one.
Essential:
Upvotes: 2
Reputation: 21969
You can use the VisualStatesGroups that are HorizontalCompression
and VerticalCompression
, so that you're able to detect when you're around the bottom of a ListBox
.
This has been around since Mango so isn't a new WP8 feature, but definitely sounds better than your current solution of "hacky" event handlers.
If you're not avert to changing the control, there is LongListSelector
, found in the Windows Phone Toolkit (note this is native in WP8) which may certainly be a better way to approach the problem, it's mentioned in the linked article that this is the new way to do what the old article got at for Mango.
Upvotes: 0