Silverlight combobox selecteditem not updating datingdramatypes com
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? Add(name) Next _selected Name = default Name End Sub Public Read Only Property My List() As Observable Collection(Of String) Get Return _mylist End Get End Property Public Read Only Property Selected Name() As String Get Return _selected Name End Get End Property End Class Class Window1 Private obj1 As My List Object Private obj2 As My List Object Private odp As Object Data Provider Public Sub New() Initialize Component() Dim namelist1 As New List(Of String) namelist1. Add("Steve") obj1 = New My List Object(namelist1, "Steve") . Find Resource("My List Object"), Object Data Provider) odp. It appears that you have a list of strings and want the binding to just do string matching against the actual item content in the combobox, so if you tell it which property to use for the Selected Value it should work; at least, that worked for me when I ran across this problem. Selected Text Tip: Selected Value is preferred for Combo Style. However, when I click a button to switch the Object Instance to obj2, the Combo Box Items Source gets populated correctly in the dropdown, but the Selected Value is set to Nothing instead of being equal to obj2. Problem: The Combo Box class searches for the specified object by using the Index Of method. took me more than a week to resolve this small fyn.
What seems to be the issue is that the Selected Value/Selected Item is occurring before the Item source is finished loading.
Next when ever you assign a new object in the View Model to that Property Selected Object should be saved to that Property and not the private member.
The viewmodel Proptery should look like this I was fighting with this issue for a while. To String())); private Key Type _Selected Key = new Key Type(); public Key Type Selected Key #endregion Selected Key I had this problem with a Combo Box displaying a list of colors ( List ).
I have noticed that the Selected Index property doesn't cause the same bug.
If you can restructure your View Model to expose the index of the selected item, and bind to that, you should be good to go. First add the following code to the View Is Synchronized With Current Item="True".