WPF ListBox ScrollIntoView有关问题求解

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()方法来滚动到指定的项,但我测下来也是以像素为单位的,如何让其以项为单位向下滚动?
------解决思路----------------------
引用:
Quote: 引用:

这个不好控制的。要显示的项  可能是中间项,而不是第一个或者最后一个。
不如滚入 视图后改变项的背景色,以此区分。


我们这边就是有这需求啊,光改背景色不满足啊。
之前用Grid+ScrollView实现,ScrollView的ScrollToVerticalOffset()方法设置偏移单位是也不是项,显示器分辨率不同时,Scroll不到我要显示的项!

笨方法:我不知道 你的ListBox 中的项顺序有什么要求没,如果么有,就是每scrollintoView的时候,都把要显示的项 放到你Listbox数据源的第一个位置,重新刷新listbox,并将ScrollToVerticalOffset设置成0,也就是滚动条在最上部;
------解决思路----------------------
先ScrollIntoView到列表最后一项,再ScrollIntoView到你要去的项,这样就应该在显示框的最顶了,除非是倒数那几个
不过这样效果可能有点不好,刷的厉害,你可以试试看.