Binding Combobox SelectedItem by a field's value
- by Navid Farhadi
Combobox bind to a set of Provinces, Village object has ProvinceID field and i want to bind SelectedItem of Combobox to a Province with Village's ProvinceID.
My code is:
<ComboBox ItemsSource="{Binding ProvincesList}"
DisplayMemberPath="ProvinceName"
SelectedValuePath="ProvinceID"
SelectedValue="{Binding Village.ProvinceID}" />
But SelectedItem is anything.