Silverlight combobox selectedvalue not updating
The object is returning the correct object via the get in the property though.I'm not sure if this is just an issue with the way the Combo Box and MVVM pattern works. I have had similar issues and it was solved by making sure I was implementing IEquatable properly.
If you’re familiar with Silverlight, nothing here should look out of place.Those comboboxes are bound to a collection in my code behind, and the selected value is a property of my object bound from the listbox.The problem is that the bound object only know an ID (int), which is a member of the objects in the collection, but not the whole object.In my application, I like the way the view model is structured and the XAML is laid out and I don’t want to change the way things work, so what do I do? There are other workarounds such as subclassing Combo Box, but I’m of the opinion that much of the Silverlight and WPF framework code wasn’t written with subclassing in mind and it can be more of a pain to subclass than it is to attach a behavior of some sort to an existing class.If my binding is being deleted on a null value, can I re-add it? In addition to this, I personally find it easier to attach a behavior and if the reason for the behavior is ever fixed, I can simply remove the behavior wherever it’s used. So instead of subclassing, I’m going to go with behavior attaching, and this is where the Expression SDK comes in.
We're binding the Category ID property on the Product as the selected value (using the Selected Value property). Below are some of the excerpts from the blog Selected Item – Selected Item helps to bind the actual value from the Data Source which will be displayed.