Adding RadComboBox SelectedItems to ListBox Problem

2 posts, 0 answers
  1. Bryce
    Bryce avatar
    32 posts
    Member since:
    Aug 2010

    Posted 04 Jan 2012 Link to this post


    Right now I have a RadComboBox with a ListBox next to it. What I want to happen is the user can type into the editable radcombobox and select the item they want in the drop down menu, or just click the dropdown button to open the drop down menu and select an item, and that item with be added to the ListBox. I thought this would be fairly simple, however, When I select an item in the drop down list when i type in it, the focus is still on the editable RadComboBox after the item is selected, and then if I delete whats in the editable combobox and start typing again, the RadComboBox drop down menu does not show up and it will automatically choose the first item closest to the text being typed and add it to the list. When I click the drop down button, it opens the drop down menu and I am able to add it to the list.

    Here is my code:

    <telerik:RadComboBox SelectedItem="{Binding SelectedItem, Mode=TwoWay}"
                                         ItemsSource="{Binding Contacts, Mode=TwoWay}"
                                         Style="{StaticResource ContactsComboBoxStyle}"/>

    <Style x:Key="ContactsComboBoxStyle" TargetType="telerik:RadComboBox" >
            <Setter Property="Margin" Value="0 1 0 0" />
            <Setter Property="Grid.Column" Value="0" />
            <Setter Property="VerticalAlignment" Value="Top" />
            <Setter Property="Height" Value="26" />
            <Setter Property="Width" Value="150" />
            <Setter Property="EmptyText" Value="Add Contact" />
            <Setter Property="IsEditable" Value="True" />
            <Setter Property="OpenDropDownOnFocus" Value="True" />
            <Setter Property="StaysOpenOnEdit" Value="True" />
            <Setter Property="IsTabStop" Value="True" />
            <Setter Property="IsFilteringEnabled" Value="True" />
            <Setter Property="TextSearchMode" Value="StartsWith" />
            <Setter Property="StaysOpenOnEdit" Value="True" />
            <Setter Property="OpenDropDownOnFocus" Value="True" />
            <Setter Property="IsMouseWheelEnabled" Value="True" />
            <Setter Property="CanAutocompleteSelectItems" Value="False" />

    private ContactViewModel mSelectedItem;
            public ContactViewModel SelectedItem
                get { return mSelectedItem; }
                    mSelectedItem = value;
                    if (mSelectedItem != null && !NewContacts.Contains(mSelectedItem))

    Is there a way to fix this?



    I noticed the same thing happened with the first RadComboBox in your demos: 

    What happens is when I click the drop down, the drop down menu will open, and then when I start typing it will go to the correct RadComboBoxItem and then when I press enter, the SelectedItem will be displayed in the RadComboBox. However, if I start typing after pressing enter, the drop down menu will not open, but it will Select a different item in the RadComboBox based on what I was typing. What I want is to be able to have the drop down menu open again, and have the user be able to see their options and down arrow click to the new item they want to select.

    Thanks again.
  2. Valeri Hristov
    Valeri Hristov avatar
    2252 posts

    Posted 06 Jan 2012 Link to this post

    Hello Bryce,

    The default behavior of RadComboBox is to keep its drop-down closed unless the user explicitly opens it via a mouse click or pressing PgDown. I created a simple attached behavior that opens the drop-down when the user types text, please find attached a sample application.

    I hope this helps.

    Valeri Hristov
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Back to Top