SelectedItem not displayed

2 posts, 0 answers
  1. Chris
    Chris avatar
    53 posts
    Member since:
    Oct 2012

    Posted 03 Jun 2010 Link to this post

    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=""



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


                                                       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.



  2. Valeri Hristov
    Valeri Hristov avatar
    2252 posts

    Posted 07 Jun 2010 Link to this post

    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.

    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.
  3. DevCraft banner
Back to Top