public static void SmoothScrollNavigation(this Windows.UI.Xaml.Controls.ListViewBase listViewBase, int scrollAmount, ScrollNavigationDirection scrollNavigationDirection, bool disableAnimation = false) { var scrollViewer = listViewBase.FindDescendant <ScrollViewer>(); if (scrollNavigationDirection == ScrollNavigationDirection.Left) { scrollViewer.ChangeView(scrollViewer.HorizontalOffset - scrollAmount, scrollViewer.VerticalOffset, null, disableAnimation); } else if (scrollNavigationDirection == ScrollNavigationDirection.Up) { scrollViewer.ChangeView(scrollViewer.HorizontalOffset, scrollViewer.VerticalOffset - scrollAmount, null, disableAnimation); } else if (scrollNavigationDirection == ScrollNavigationDirection.Right) { scrollViewer.ChangeView(scrollViewer.HorizontalOffset + scrollAmount, scrollViewer.VerticalOffset, null, disableAnimation); } else if (scrollNavigationDirection == ScrollNavigationDirection.Down) { scrollViewer.ChangeView(scrollViewer.HorizontalOffset, scrollViewer.VerticalOffset + scrollAmount, null, disableAnimation); } }
public static void SmoothScrollNavigation(this ListViewBase listViewBase, int scrollAmount, ScrollNavigationDirection scrollNavigationDirection, bool disableAnimation = false) { var scrollViewer = listViewBase.GetScrollViewer(); if (scrollNavigationDirection == ScrollNavigationDirection.Left) { scrollViewer.ChangeView(scrollViewer.HorizontalOffset - scrollAmount, scrollViewer.VerticalOffset, null, disableAnimation); } else if (scrollNavigationDirection == ScrollNavigationDirection.Up) { scrollViewer.ChangeView(scrollViewer.HorizontalOffset, scrollViewer.VerticalOffset - scrollAmount, null, disableAnimation); } else if (scrollNavigationDirection == ScrollNavigationDirection.Right) { scrollViewer.ChangeView(scrollViewer.HorizontalOffset + scrollAmount, scrollViewer.VerticalOffset, null, disableAnimation); } else if (scrollNavigationDirection == ScrollNavigationDirection.Down) { scrollViewer.ChangeView(scrollViewer.HorizontalOffset, scrollViewer.VerticalOffset + scrollAmount, null, disableAnimation); } }