コード例 #1
0
        private void MessagesListBox_OnScrollChanged(object sender, ScrollChangedEventArgs e)
        {
            var scrollViewer =
                VisualTreeHelperExtensions.GetDescendantByType((ListBox)sender, typeof(ScrollViewer)) as ScrollViewer;

            if (scrollViewer.VerticalOffset == scrollViewer.ScrollableHeight)
            {
                _viewModel.AtListBottom = true;
                scrollViewer.PageDown();
            }
            else
            {
                if (_viewModel.AtListBottom)
                {
                    scrollViewer.ScrollToVerticalOffset(scrollViewer.VerticalOffset - 50);
                }
                _viewModel.AtListBottom = false;
            }
        }