WPF ListBox generate items as user scrolls
问题 I am trying to use a ListBox to display a possibly infinite list of options to a user. Currently, I am simply cutting off the list at an arbitrary point, but I would like to allow the user to scroll down as far as they want. Also, I want to avoid generating non-visible items as much as possible as some computation has to be done to generate each item. I tried writing listBox.ItemsSource = enumerable expecting it to only ask the enumerable for visible items, but instead it tries to read all of