Silverlight combobox selecteditem not updating
Public Class My List Object Private _mylist As New Observable Collection(Of String) Private _selected Name As String Public Sub New(By Val name List As List(Of String), By Val default Name As String) For Each name In name List _mylist. Add("Tim") obj2 = New My List Object(namelist2, "Tim") odp = Direct Cast(Me. Solution: So, try to set Selected Index using Selected Value via Converter like this: C# code Is it reasonable to set the Selected Value Path="Content" in the combobox's xaml, and then use Selected Value as the binding?
The Binding Mode needs to be One Way To Source or Two Way since the source is what you want updated. In my case I was using in complex type (List) as the Item Source and was using a Key Type as the selected value. Selecting a color was possible but it wasnt displayed when the selection closed (although the property was changed!On the load event, the Key Type was getting set to null. None of the sub elements would get updated when the key changed. ) The fix was overwriting the Equals(object obj) method for the type selected in the Combo Box (Brush), which wasnt simple because Brush is sealed.When the binding occurs, it is trying to see if the objects match so make sure you are properly implementing your equality checking.
In this case, the selecteditem bind doesn't work, because the hash id of the objects are different.
Mode One Way is Source to Target and therefore makes the Source Read Only which results in never updating the Source. I've been fighting with this issue for hours today, and you know what I found out? The list that was populating the Combo Box was Int64, and I was trying to store the value in an Int32 field!