How can I have a ListBox auto-scroll when a new item is added?

后端 未结 12 2361
走了就别回头了
走了就别回头了 2020-11-28 20:34

I have a WPF ListBox that is set to scroll horizontally. The ItemsSource is bound to an ObservableCollection in my ViewModel class. Every time a new item is added, I want th

12条回答
  •  -上瘾入骨i
    2020-11-28 21:06

    I use this solution: http://michlg.wordpress.com/2010/01/16/listbox-automatically-scroll-currentitem-into-view/.

    It works even if you bind listbox's ItemsSource to an ObservableCollection that is manipulated in a non-UI thread.

提交回复
热议问题