This question is locked. New answers and comments are not allowed.
I am using the RadComboBox to show a list of countries in a data entry screen
the items are bound to an observable collection that contains a list of country objects that have a Name as well as a Code property ("United States", "US")
I set the ItemsSource to the observable collection and the DisplayMemberPath to "Name"
Now on the other hand i want to bind the SelectedItem to a database field on the screen. The parent is data bound and i simply set the
which works fine for a simple standard combobox without name/code pairs
Now with the RadCombo it doesnt show the value from the database. When i select an item in the combo i have to select it twice to show the name and when i reopen the screen even though the values are saved in the database the name is not shown in the combobox
the items are bound to an observable collection that contains a list of country objects that have a Name as well as a Code property ("United States", "US")
I set the ItemsSource to the observable collection and the DisplayMemberPath to "Name"
Now on the other hand i want to bind the SelectedItem to a database field on the screen. The parent is data bound and i simply set the
| SelectedItem="{Binding CountryCode, Mode=TwoWay}" |
which works fine for a simple standard combobox without name/code pairs
Now with the RadCombo it doesnt show the value from the database. When i select an item in the combo i have to select it twice to show the name and when i reopen the screen even though the values are saved in the database the name is not shown in the combobox
| private ObservableCollection<Country> countries; |
| public ObservableCollection<Country> Countries |
| { |
| get |
| { |
| if (countries == null) |
| { |
| countries = new ObservableCollection<Country>(); |
| countries.Add(new Country("Austria", "AT")); |
| countries.Add(new Country("United States", "US")); |
| countries.Add(new Country("Canada", "CA")); |
| } |
| return countries; |
| } |
| } |
| public mfgr_AddEdit() |
| { |
| // Required to initialize variables |
| InitializeComponent(); |
| CountryCombo1.ItemsSource = Countries; |
| CountryCombo1.DisplayMemberPath = "Name"; |
| CountryCombo1.SelectedValuePath = "Code"; |
| } |
// ------------------------------------------
am i missing something ?
thanks
Mike