Detect when WPF listview scrollbar is at the bottom?

前端 未结 4 894
别那么骄傲
别那么骄傲 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:14

    //A small change in the "Max's" answer to stop the repeatedly call.
    //this line to stop the repeatedly call
    ScrollViewer.CanContentScroll="False"
    
    private void dtGrid_ScrollChanged(object sender, ScrollChangedEventArgs e)
                    {
    //this is for vertical check & will avoid the call at the load time (first time)
                        if (e.VerticalChange > 0)
                        {
                            if (e.VerticalOffset + e.ViewportHeight == e.ExtentHeight)
                            {
                                // Do your Stuff
                            }
                        }
                    }
    

提交回复
热议问题