How to scroll a ListViewItem to the top of the ListView

I have a virtualized ListView filled with at least 500 items having different heights of each ListViewItem. ListView Properties set as:

<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Hidden"/> <Setter Property="ScrollViewer.CanContentScroll" Value="True"/> <Setter Property="VirtualizingPanel.ScrollUnit" Value="Pixel" /> <Setter Property="BorderBrush" Value="Transparent"/> <Setter Property="BorderThickness" Value="0"/> <Setter Property="Margin" Value="0"/> <Setter Property="HorizontalAlignment" Value="Stretch"/> <Setter Property="HorizontalContentAlignment" Value="Stretch"/>

I need to scroll up a selected Item to the top of the list. I have looked into the stackoverflow solutions ( 1, 2, 3) , but those did not work as expected in my scenario some how. Thanks with appreciation for a hint/guidance towards a solution in advance.

链接地址: http://www.djcxy.com/p/44660.html

上一篇: WPF绑定到My.Settings的单选按钮(使用vb.net)

下一篇: 如何将ListViewItem滚动到ListView的顶部