Detect when WPF listview scrollbar is at the bottom?

前端 未结 4 904
别那么骄傲
别那么骄傲 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 17:57

    I figured it out. It seems I should have been getting events from the ScrollBar ( in XAML) itself, rather than the viewer. This works, but I just have to figure a way to avoid the event handler being called repeatedly once the scrollbar is down. Maybe a timer would be good:

    private void currentTagNotContactsList_Scroll(object sender, ScrollEventArgs e) {
    
        ScrollBar sb = e.OriginalSource as ScrollBar;
    
        if (sb.Orientation == Orientation.Horizontal)
            return;
    
        if (sb.Value == sb.Maximum) {
            Debug.Print("At the bottom of the list!");
    
        }
    
    }
    

提交回复
热议问题