-
ListViewAutomationPeer view = new ListViewAutomationPeer(this.PART_ListView);
-
var swap = view.GetPattern(PatternInterface.Scroll) as ScrollViewerAutomationPeer;
-
ScrollViewer scroll = swap.Owner as ScrollViewer;
-
if (scroll.ContentVerticalOffset + scroll.ViewportHeight == scroll.ExtentHeight)
-
scroll.ScrollToEnd();
实现:当前位置在滚动条最下方是持续下沉
scroll参数介绍:
ContentVerticalOffset:可见内容的垂直偏移量。也就是当前窗口里可以看见的list的第一条基于总数的index
ViewportHeight:内容视区垂直大小 也就是当前这个窗口一共有多少条
ExtentHeight:表示此盘区的垂直大小 整个list的总条数