I have a ComboBox like this
It's blank because you don't have anything selected in the first place. If I'm not mistaken, you have to either use SelectedItem
to bind your selection or SelectedValue
with SelectedValuePath
.
I actually never use SelectedValue
with SelectedValuePath
myself, so after initializing collection of items which ComboBox.ItemSource will be binded to - for example ObservableCollection
- I also set selected item property Person SelectedPerson {get; set;}
to one of the values from collection. Then I bind ComboBox.SelectedItem to this property, so on initialization it shows predefined selected value.
I guess you can achieve the same with SelectedValue
and SelectedValuePath
, but you have to use them together as described here.