对于TreeView而言:
            TreeViewAutomationPeer lvap = new TreeViewAutomationPeer(treeView);
            var svap = lvap.GetPattern(PatternInterface.Scroll) as ScrollViewerAutomationPeer;
            var scroll = svap.Owner as ScrollViewer;
             //////////////////////////此处添加你想要对TreeView自身滚动条的操作///////////////////////////
            scroll.ScrollToVerticalOffset(scroll.VerticalOffset+1);    //向下调节垂直滚动条的位置;
对于ListView而言:
            ListViewAutomationPeer lvap = new ListViewAutomationPeer(listView);
            var svap = lvap.GetPattern(PatternInterface.Scroll) as ScrollViewerAutomationPeer;
            var scroll = svap.Owner as ScrollViewer;
             //////////////////////////此处添加你想要对TreeView自身滚动条的操作///////////////////////////
            scroll.ScrollToVerticalOffset(scroll.VerticalOffset+1);    //向下调节垂直滚动条的位置;

 

posted on 2014-10-11 16:33  褚海达  阅读(2014)  评论(0编辑  收藏  举报