I have a listbox that can potentially have a large number of items with backing data. In order to handle data virtualization, I have tied into WPF's UI virtualization by writing a collection that implements the same interfaces as ObservableCollection and can spin up our backing data as needed.
This works fine. The problem comes when I introduce multi-select with the listbox. Because listbox manages selected items by object rather than index (SelectedItems), selecting all of the items causes all of the backing data to be spun up and held in memory by the listbox, defeating the data virtualization...
Is there a way to prevent this from happening other than re-writing ListBox to manage selection by index instead of object?
Thanks!
Eric