【问题标题】:Detect when ListView is scrolled to the bottom检测 ListView 何时滚动到底部
【发布时间】:2013-04-29 13:58:02
【问题描述】:

我有一个带有 GridView 的相当标准的 ListView:

<ListView x:Name="ListViewProducts" ItemsSource="{Binding Products}">
    <ListView.View>
        <GridView>
            <GridViewColumn Header="Id" Width="50" DisplayMemberBinding="{Binding Id}"/>
            <GridViewColumn Header="Name" Width="200" DisplayMemberBinding="{Binding Name}"/>
        </GridView>
    </ListView.View>
</ListView>

我想实现无限滚动到这个 ListView,只要用户滚动到列表底部,就会加载新项目。我尝试使用 VisualTreeHelper 获取 ListView 的 ScrollViewer,但 ListViewProduct 显然没有孩子:

VisualTreeHelper.GetChildrenCount(ListViewProducts) // Gives 0

因为孩子的数量是 0,所以这样的答案不起作用:http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/794815aa-9a1e-4b57-b097-71d8672f331b/。

如何检测用户何时滚动到 ListView 底部?

【问题讨论】:

标签: wpf listview gridview .net-4.0 scrollviewer


【解决方案1】:

我猜你必须获取ListView 的内部ScrollViewer,因为我认为ScrollViewer 提供了滚动行为。
在你做到这一点之后,this post 可能会帮助你。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2010-11-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-11-22
    • 2012-09-25
    • 2020-09-24
    相关资源
    最近更新 更多