Detect when WPF listview scrollbar is at the bottom?

前端 未结 4 900
别那么骄傲
别那么骄傲 2020-12-17 17:17

Is there a way to detect if the scrollbar from the ScrollViewer in a ListView has reached the bottom of the virtual scroll space? I would like to

4条回答
  •  遥遥无期
    2020-12-17 18:08

    you can try this way:

     
    

    and in Back:

     private void Scroll_ScrollChanged(object sender, ScrollChangedEventArgs e)
        {
            // Get the border of the listview (first child of a listview)
            Decorator border = VisualTreeHelper.GetChild(sender as ListView, 0) as Decorator;
            // Get scrollviewer
            ScrollViewer scrollViewer = border.Child as ScrollViewer;
            if (scrollViewer.VerticalOffset == scrollViewer.ScrollableHeight)
            Debug.Print("At the bottom of the list!");
        }
    

提交回复
热议问题