This is a migrated thread and some comments may be shown as answers.

SelectedItem not displayed

1 Answer 85 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Chris
Top achievements
Rank 1
Chris asked on 03 Jun 2010, 07:01 PM

In the XAML, I have the following RadComboBox, and the grid’s (LayoutRoot) DataContext is set during the constructor (to the instance of the page itself).

 

 

                            <telerikComboBox:RadComboBox x:Name="GenderLookUpField" Text=""

                                                        

                                                   DisplayMemberPath="DisplayName"                                                         

                                                   SelectedValue="{Binding Path=Person.LookupID, Mode=TwoWay}"

                                                   SelectedValuePath="ID"

                                                   IsEditable="True" />

 

 

 

 

Also within the constructor, the following is called to populate the combobox. Each item below has properties named ‘DisplayName’ (string) and ‘ID’ (integer). 

 

private void PopulateDropDowns()

        {

           GenderLookUpField.ItemsSource = list; /* List<Item> */

        }

 

Later,  after the page’s Load is complete, the ‘Person’ property has its value fetched and set (Person property  is a dependency property). Person.LookupID has an integer value (e.g. 1).

 

Unfortunately, when the UI is displayed, the RadComboBox does not select the corresponding item from the ItemsSource.

Regards,

Chris

1 Answer, 1 is accepted

Sort by
0
Valeri Hristov
Telerik team
answered on 07 Jun 2010, 09:04 AM
Hi Chris,

I already answered your support ticket, you should make the binding on SelectedItem TwoWay:
SelectedItem="{Binding Person, Mode=TwoWay}"

RadComboBox internally sets SelectedItem and the binding is lost if it is not TwoWay.

Regards,
Valeri Hristov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
ComboBox
Asked by
Chris
Top achievements
Rank 1
Answers by
Valeri Hristov
Telerik team
Share this question
or