Calculate Horizontal Offset to scroll ListView to the center of the SelectedItem

試著忘記壹切 提交于 2019-11-30 05:43:35

https://msdn.microsoft.com/library/windows/apps/windows.ui.xaml.controls.listview.aspx

You should use one of the two "ScrollIntoView" methods.

Filip Skakun

ListView.ScrollIntoView() should work. There might be issues with calling a method to scroll a ScrollViewer while it's already scrolling though. I would try fiddling with ScrollViewer.InvalidateScrollInfo() which might speed it up. Otherwise - you could try handling the ViewChanging/ViewChanged events to see if it's scrolling and try to use that information together with ScrollViewerViewChangedEventArgs.IsIndeterminate to chain the calls.

Also check my answer to this question: Centering selected item in a scroll viewer

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!