I’ve got a list box where the items are check boxes. When the list box is scrolled I am finding that the Checked and Unchecked events are firing for items as they either scroll into view or scroll out of view.
It seems related to what this post discusses:
Silverlight 3 Checkbox Listbox bug when scrolling?
The problem I have is the events firing, because I am updating data on the server when this happens. So I get all this spurious server comms when I only want it to happen when the user changes the state of the check box.
Is there some way to stop this event firing when scrolling?
I don’t think the
CheckedandUncheckedevents are fit for the purpose you are putting them to. They were really designed to affect visual state. Instead you should be binding a boolean property on on listed item object to theIsCheckedproperty of the Checkbox. Code in the setter in the item object can then kick off the server stuff (for belts and braces it could compare current value with incoming value).To answer your question you might try specifying plain old
StackPanelin the template for theItemsPanelproperty of the list box. Although this might not be an option if you a lot of entries.