Wpf combobox binding selecteditem not updating

6854933580_2c8b688306_z

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.

I was able to solve it but the reason of the issue is not clear.Here is my xaml: Here is my Web Service completed method, where I populate the Items Source (which works) and then I try to set the Selected Item (which doesn't update the UI, but my Selected Item raise property event does fire) This problem is driving me absolutely bonkers!I also tried setting up a binding to Selected Index, but that doesn't work either.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. the combobox for the Selected Rol correctly displays the property when the property gets a new value (from a selection Changed event in a listbox) However, with almost exactly the same code, the Selected PSoort combobox never displays anything.

You must have an account to comment. Please register or login here!