Wpf combobox itemssource not updating
The issue was that my view model inherited from a base view model which implemented a property changed method.
I had a property changed event in my view model as well because I didn't realize this base view model class had one in there.
My example data item doesn't implement INotify Property Changed, but our actual data items do, so they update correctly.
I'm trying to get a WPF combobox working (inside the WPFToolkit Datagrid), and I'm having trouble getting all the pieces aligned correctly.
Now, all of that aside, let’s go over the more common properties used in Data Binding to a Selector control.
Now that we’ve got a decent understanding of the common binding properties of a Selector control (I hope! Given the following classes (only class signatures; the full sample project including source code is attached to this post): Note the use of “Mode=One Way” in my Items Source bindings.
I have tried Selected Item, Selected Index, Text and nothing works for me.
At that point, the displayed value returns to the original value, not to the newly selected value.Once I removed the property changed event from my view model, everything worked just fine.The reason why it was so hard for me to pin this down is because the collections for the combos populated just fine, when I had my property changed event in my view model.Note that the information in this post may also be applied to other controls implementing Items Control. Along the way, I came across a situation where I needed to do some different kinds of binding using Combo Boxes.My specific case was a bit more complex because I was binding to the page View Model (which I didn’t want to instantiate more than once as it made web service calls) to a Combo Box in a Data Template for a cell in a Grid View.
There wasn’t much documentation regarding that which I found that was helpful, so I’ll do another post about that later.