You get too attached; you need to set only SelectedValue and SelectedValuePath , or SelectedItem . In this case, it looks like you are actually trying to bind to a specific object. If you are trying to set the ComboBox Category property to your Book , and the current Book object has a link to the Category instance that is in the categoryList , then you should use SelectedItem and remove the bindings for SelectedValue and SelectedValuePath .
Edit
To talk a little about how this is done, SelectedValue intended to be used when you have a common piece of information to associate a related item with a property in the list source. For example, suppose I have a Book class with the CategoryID property.
public class Book { public string CategoryID { get; set; } public string Title { get; set; } } public class CategoryID { public string ID { get; set; } public string Name { get; set; } }
In this case, you will do:
<ComboBox SelectedValue = "{Binding CategoryID}" SelectedValuePath = "ID" DisplayMemberPath = "Name" />
SelectedItem , on the other hand, means that the linked instance has an actual reference (or rather, an object that is equivalent) to an element in the linked list. So, suppose the Book class looks something like this:
public class Book { public Category Category { get; set; } public string Title { get; set; } }
In this case, you will do:
<ComboBox SelectedItem = "{Binding Category}" DisplayMemberPath = "Name" />
But itβs very important to note that this will not work if the Book class does not refer to the same Category instance as in the list . If the links are different (even if the values ββin the classes are equal), then this will not work, because the ComboBox will not be able to find the Category that is referenced in the Book in the list.
The real problem with the way you linked it on top (binding to Category.ID ) is that you are mixing schemes. You have a link, but instead you are trying to bind it to a key. All this will try to set the value in your link, will not try to change the link to your class .