Wpf combobox not updating when source updates
I have created a simplified example illustrate this problem. So in the image above, I have a Text Block (in black) that shows the 'Selected Person. The First Name and Last Name properties of the Selected Person are shown in the 2 Text Boxes below the Full Name.
The Combo Box Display Member Path is bound to 'Full Name' and the combobox contains a list of Person objects.
This property is bound to the selected item of a combo box. I think the whole answer is to implement full IEquatable that means implementing its Equals method and overriding Object. Get Hash Code methods as in this example (see the end of "Remarks" section - "Notes to Implementers" - and "Examples" section).
When i change the combo box, the source property is being updated fine, but when I change the source property or when the control is initialized, the event and the Trace Source output shows me that the binding detected it and transferred the value, its just that the combobox isn't reflecting it. EDIT: output from the trace source is this: System. Data Warning: 91 : Binding Expression (hash=23631369): Got Property Changed event from Report View Model (hash=52844413) System. Data Warning: 97 : Binding Expression (hash=23631369): Get Value at level 0 from Report View Model (hash=52844413) using Runtime Property Info(Sub Grouping View): Data Column View Model (hash=58231222) System. Data Warning: 76 : Binding Expression (hash=23631369): Transfer Value - got raw value Data Column View Model (hash=58231222) System. Data Warning: 80 : Binding Expression (hash=23631369): Transfer Value - implicit converter produced Data Column View Model (hash=58231222) System. Data Warning: 85 : Binding Expression (hash=23631369): Transfer Value - using final value Data Column View Model (hash=58231222) The object returned from your Sub Grouping View must be "equal" to one of the objects in the Combo Box. If they are functionally the same, but not returning true when compared then that's your problem.
Items (which means it must be in your Columns collection). You would need to either return the same object, or override the Equals method (and potentially the == and ! If this is your issue, it's the same problem as in this question.
I have an updating issue with Binding in my Combo Box.
I’m not sure yet whether using Collection View is a better approach than the alternatives I have seen which bind the Selected Value or Selected Item property.
I would be interested to hear in the comments if you think either approach has benefits over the other.
Even if some month were gone since you published your article it provides exactly what I was looking for.
I have attempted to send a "Full Name" notify when I send 'Selected Person' notify, but it doesn't make it work either.
Can anybody tell me why the Combo Box isn't updating when I change the First Name text?
The code in the View Model first creates the List, and then creates a Collection View based on that list.
This allows us to set the Current Item from the View Model as well as get notified whenever the Current Item changes.
The combo Box Dropdown just updates the first time it is opened and doesn't update after that.