I have a Listbox that is filled with 30,000 elements
<ListBox Name="lbWordlist"
Grid.Row="1" Margin="10"
ItemsSource="{Binding Source={StaticResource WordListViewSource}}"
SelectedItem="{Binding Source={StaticResource MainViewModel}, Path=SelectedArticle}"
IsSynchronizedWithCurrentItem="True"
SelectionChanged="lbWordlist_SelectionChanged" />
I'm tracking history of user clicking items
I have 2 buttons Prev. and Next, these buttons allow user to go back and forward in history.
Prev. and Next button modify SelectedItem property of ListBox
The problem comes up, if user selects random items from ListBox that are very apart from each other (for example user selected some items on top of the list and few items in the bottom of the list).
Prev. and Next button change SelectedItem property, but ListBox is not synced with scroll, selected item is not highlighted and most of the times is not visible to user, as it's outside of ListBox's visible items area.
Is there any way to make ListBox correctly show currently selected item?
Thank You.
_listBox.ScrollIntoView(_listBox.SelectedItem);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With