WPF ListBox ScrollIntoView问题求解
官方文档上解释ScrollIntoView方法:
If the specified object is not visible, calling ScrollIntoView causes it to align at the top or bottom of the viewport. When the contents of the ItemsSource collection changes, particularly if many items are added to or removed from the collection, you may need to call UpdateLayout() prior to calling ScrollIntoView for the specified item to scroll into the viewport.
我的问题是:将项显示在视框内时,如何指定将项显示在视框的顶端?
另外:有人说的获取ListBox内的ScrollView,调它的ScrollToVerticalOffset()方法来滚动到指定的项,但我测下来也是以像素为单位的,如何让其以项为单位向下滚动?