示例#1
0
        private void MyListviewLoaded(object sender, RoutedEventArgs e)
        {
            this.MyListView.ItemsSource = items;

            items.CollectionChanged += (s, args) => ScrollToBottom();

            var scrollViewer =
                MyListView.GetFirstDescendantOfType <ScrollViewer>();

            var scrollbars =
                scrollViewer.GetDescendantsOfType <ScrollBar>().ToList();

            var verticalBar = scrollbars.FirstOrDefault(x => x.Orientation == Orientation.Vertical);

            if (verticalBar != null)
            {
                verticalBar.Scroll += BarScroll;
            }
        }