问题
I am using a ListView
in a Windows 8 Metro style app and I want to programatically make it scroll to a point where a particular item is in the view.
Is this possible?
回答1:
Not sure if you're working with JavaScript or XAML, but in JavaScript you should be able to just set the ensureVisible(index)
property of the ListView. This will make sure that item is visible, scrolling the ListView if necessary:
- http://msdn.microsoft.com/en-us/library/windows/apps/br211820.aspx
In XAML, the ScrollIntoView(object)
should be what you need. (For SemanticZoom, see MakeVisible
.)
- http://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.controls.listviewbase.scrollintoview.aspx
来源:https://stackoverflow.com/questions/12038022/windows-8-metro-style-listview-auto-scroll