It is hard to believe that you guys would make the same mistake as Microsoft, and not include a SelectedValue dependency property on your XamComboBoxEditor. Will this be included in a service release or is it planned for a future implementation?
Hi,
I believe you should be able to achieve everything with the SelectedItem property, as a SelectedValue would essentially just be a property that is on the SelectedItem.
Could you explain what your use case is for needing a SelectedValue property? I could probably help you solve your problem. Otherwise, if it's something that really is necessary, we can look into adding as a feature in the future.
-SteveZ
Lets say I have a collection of objects defined as follows:
ObservableCollection<State> states;
public class State
{
public Guid Id {get;set;}
public string Value {get;set;}
}
Now I am a customer object that has a property on it call StateId as follows
public class Customer
public Guid StateId {get;set;}
If my ItemsSource to the XamWebComboEditor is a collection of states the SelectedItem will be of type State. So when I am data binding my StateId property of my Customer to the SelectedItem of the ComboBox, it is expecting a type of State and not Guid. So when a new selection is made, a state object is sent to my property's setter not a Guid, and when the combo is created, it will not selected the correct state since it is trying to bind to type State and not Guid.
Basically, this is a very common scenario, especially in web development. In WebForms you have a combo box that displays text, but uses a different value for binding.