Пример #1
0
        private void TextView_ScrollOffsetChanged(object sender, EventArgs e)
        {
            var textView = (TextView)sender;
            if (DataContext == null)
                return;

            if (textView.DataContext != DataContext)
                return;

            ScrollOffsets.Remove(DataContext);
            ScrollOffsets.Add(DataContext, textView.ScrollOffset);
        }
Пример #2
0
        private void OnDataContextChanged_Scroll(object sender, DependencyPropertyChangedEventArgs e)
        {
            if (e.NewValue == null)
                return;

            object scrollOffset;
            if (ScrollOffsets.TryGetValue(e.NewValue, out scrollOffset))
            {
                Dispatcher.BeginInvoke(new Action(() =>
                {
                    ScrollToHorizontalOffset(((Vector)scrollOffset).X);
                    ScrollToVerticalOffset(((Vector)scrollOffset).Y);
                }));
            }
        }