having trouble clearing a listBox that is databound.
Greetings everybody.
I'm new to .net and WPF and I've bumped into a problem I can't seem to figure out.
I wan't to clear all items from a listBox just prior to refresing it's data.
Using XAML, the listBox is bound to a DataSet named movies as seen below:
Now in my C# code, if I use listBox1.Items.Clear() I get this error:
"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.
Bookmarks