If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register or Login
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

"Operation is not valid while ItemsSource is in use. Access and modify elements with ItemsControl.ItemsSource instead."

I'm not 100% sure what to make of the above error message. Someone told me to clear the bindings, in order to clear the values in the listBox, but then I can't get the values to appear in the listbox in the first place.

Re: having trouble clearing a listBox that is databound.

Your ListBox is bound to a DataSet - and hence always reflects the state of the Dataset. That's why trying to manipulate the ListBox items directly leads to a conflict, and that's what the error message says. In order to clear the list, you have to modify the DataSet, and not the ListBox.

Re: having trouble clearing a listBox that is databound.

Guido is correct. If your listbox is bound to a data model (like dataset, observablecollection, etc), then you need to do the operations on the model. With the listbox databinding any changes you make to the model (add, update, remove, clear) will be reflected in the listbox. With binding you really don't perform any operations on the listbox directly.