Scroll a ListView from code, sometimes could be a headache, but you only need do this in the next way.
public MainPage()
{
InitializeComponent();
miListBox.Loaded += new RoutedEventHandler(miListBox_Loaded);
}
void miListBox_Loaded(object sender, RoutedEventArgs e)
{
miListBox.SelectedIndex = 14;
miListBox.ScrollIntoView(miListBox.SelectedItem);
}
The key of this Tip is that you must call ScrollIntoView Metod after loading ListView control.
Regards!
No comments:
Post a Comment