In my application, I have a ListBox
with items. The application is written in WPF.
How can I scroll automatically to the last added item? I want the ScrollViewer
to be moved to the end of the list when new item has been added.
Is there any event like ItemsChanged
?
(I don't want to use the SelectionChanged
event)
Try this:
lstBox.SelectedIndex = lstBox.Items.Count -1;
lstBox.ScrollIntoView(lstBox.SelectedItem) ;
In your MainWindow, this will select and focus on last item on the list!