I'm working on a Windows Phone 7 project with a listbox filled with RSS news, I want to be able to drag items down in the list box (to drag the first item down the top border) in order to load new items feeds...
I've seen this note http://www.codeproject.com/Articles/150166/Loading-Data-when-the-User-Scrolls-to-the-End-of-a.aspx, which works great to load data at the end of the ListBox, I'm trying to do the opposite; to load items at the beginning of the listbox...
In the listener attached to the ScrollViewer, following condition is used to detect that end of listbox is reached:
bool atBottom = scrollViewer.VerticalOffset
开发者_StackOverflow社区 >= scrollViewer.ScrollableHeight;
tried to change it to
bool atBottom = scrollViewer.VerticalOffset
<= s0.0;
However, it loads once I reach the top of the list, but I need to drag the top item in order to do the loading... Any Advise...
Is the issue that the VerticalOffset is at 0 to start with and you're doing your check in an event handler for when the listbox is actually scrolled?
update
There isn't a way of detecting if the user tries to scroll beyond the top of the list. Why not just periodically add the latest new info to the top of the list if there isn't any data already loaded which has never been viewed.
精彩评论