windows.UI.Xaml.ScrollViewer.ScrollToHorizontalOffset(double) is obsolete RRS feed

  • Question

  • Hi,

    I'm using scrollToHorizontalOffset(double) in this way: 

     private void areaScrollViewer_KeyUp(object sender, KeyRoutedEventArgs e)
                 FrameworkElement focusedElement = FocusManager.GetFocusedElement() as FrameworkElement;
                 GeneralTransform focusedVisualTransform = focusedElement.TransformToVisual(areaScrollViewer);
                 Rect rectangle = focusedVisualTransform.TransformBounds(new Rect(new Point(focusedElement.Margin.Left, focusedElement.Margin.Top), focusedElement.RenderSize));
                 double newOffset = areaScrollViewer.HorizontalOffset + (rectangle.Right - areaScrollViewer.ViewportWidth);

    In Windows 8.1 and Visual Studio 2013 I'm getting this warning:

    'ScrollToHorizontalOffset may be altered or unavailable for releases after Windows 8.1. Instead, use ChangeView'.

    My question is, How can I use ChangeView to replace ScrollToHorizontalOffset. I mean, there is not a way to do ScrollViewer.ChangeView.


    Tuesday, August 6, 2013 2:54 PM


  • ChangeView's arguments are the horizontal offset, vertical offset, and zoom factor. It allows animating the view change rather than just jumping directly. 

    ChangeView is new to the Windows 8.1 Preview. You cannot use it in Windows 8: stick with ScrollToHorizontalOffset there.

    • Proposed as answer by Ramprasath R Tuesday, August 6, 2013 5:31 PM
    • Marked as answer by Anne Jing Saturday, August 10, 2013 1:01 PM
    Tuesday, August 6, 2013 3:04 PM