WPF Listbox - How to keep the scrolling from changing the property?
-
Has anyone ever seen this? I have a Listbox control:
And there is a property IsSelected in the class that selecting an item changes correctly. I also have a "Select All" button and an "Unselect All" button which seem to work. After pressing the button and counting the selected objects I get the expected counts. Now my listbox has more items than fit in the view area, so the scroll bars appear. The problem comes when I press the select all button and then scroll the list box. Even though my count said they were all selected, after I scroll, the items that were not in the window at the time the button was pressed revert to their prior state. The IsSelected property is re-called by the scrolling. I don't know if I can make it any clearer. How do I keep the scroll bar from resetting the IsSelected property? Or How can I get the listbox to keep the items outside the visual area selected or unselected? Thanks for any help.
Brent