well , in your first case, I guess u can use bidirectional binding. I dont remember exact syntax but GIYF.
Main Topics
Browse All TopicsHi, I'm having trouble with data after binding it to a WPF combo box or listbox. I have a generic list of objects (generated from Linqs) which I'm binding to a combo box. Now this list will change and when it does I will need to refresh the combo box to add / remove new items in the list.
Now binding works a treat:
combobox1.itemssource = list
combobox1.DisplayMemberPat
combobox1.SelectedValuePat
The above works however, I cannot remove items from the combo box once databound. If I use combopbox1.items.clear() I get an error message concerning the itemssource.
I therefore removed this and returned to a grittier version of populating the comboxbox by looping through the generic list and adding the objects one at a time.
However, when I use items.clear() I get an "Object reference is missing" error.
Ok so after this I then tried to remove the items one at a time. Again I get the same exception rule. After trawling the net I am still trying to find an answer, please experts, how do I remove these items from a WPF combo box.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Business Accounts
Answer for Membership
by: JamesBrooksbank007Posted on 2009-01-30 at 08:39:48ID: 23510107
IF it helps, when I try and remove the items through items.clear I get the following error:
Operation is not valid while ItemsSource is in use. Access and modify elements with ItemsControl.ItemsSource instead.