带有动画的 ScrollIntoView

ScrollIntoView with animation

我有一个分组的 gridview,我需要在带有动画的组上滚动。现在我使用方法 GridView.ScrollIntoView(object item) 效果很好,但我需要添加一些动画。

计划: 我想使用 WinRTXamlToolkit 的扩展方法 GetFirstDescendantOfType<T> 从 gridview 中提取 ScrollViewer,然后使用 ScrollViewer 的方法 ChangeView(..)。我可以从 gridview ContainerFromIndex(int)ContainerFromItem(object) 获取 Container 的位置,但容器未呈现且方法 returns 为 null,因为 gridview 面板已虚拟化。

我该怎么做?任何帮助将不胜感激。

如果您想要动画滚动 - 您可以使用 WinRT XAML 工具包的 ScrollViewer.ScrollToHorizontalOffsetWithAnimation() 扩展,或者如果您的目标是 Windows 8.1 - 您可以使用新的 ScrollViewer.ChangeView() 方法,支持动画滚动。