简体   繁体   English

如何确定您是否位于列表框的底部(WP7 Silverlight)

[英]How to find out if you are at the bottom of a list box (WP7 Silverlight)

I have a list box that I am using for a leaderboard to which I add some custom controls that display the relevant information for each position. 我有一个用于排行榜的列表框,向其中添加了一些自定义控件,这些控件显示每个位置的相关信息。 At the moment the leaderboard only shows the top 25 scores. 目前,排行榜仅显示前25个得分。 I would really like it to load the next 25 if the user scrolls to the bottom of the list (ie number 25). 如果用户滚动到列表的底部(即数字25),我真的希望它加载下一个25。 This is the same behavior that can be found in the windows phone marketplace. 这与Windows Phone市场中的行为相同。 Is there an event that fires when the user scrolls all the way to the bottom or some kind of property that would indicate this? 当用户一直滚动到最底端或某种表明这种情况的属性时,会触发事件吗?

Extract the child scrollviewer of the listbox using 使用以下命令提取列表框的子滚动查看器

            var elt = VisualTreeHelper.GetChild(parent, i);
            if (elt is ScrollViewer) 
                            scrollViewer = (ScrollViewer)elt;

Use the following code in manipulation_completed event handler 在handling_completed事件处理程序中使用以下代码

            if ((scrollViewer.ScrollableHeight != 0 && scrollViewer.VerticalOffset != 0
                && (scrollViewer.ScrollableHeight - scrollViewer.VerticalOffset) <= 10) || scrollViewer.ScrollableHeight == 0)
                //do work here

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM