AutoComplete - Programmatically

3 posts, 0 answers
  1. Robert
    Robert avatar
    271 posts
    Member since:
    Mar 2011

    Posted 04 May 2012 Link to this post


    Is it possible to set the AutoComplete text programmatically?

    I have the following ListBox:
    <telerik:RadListBox MinWidth="100" MaxHeight="250" x:Name="radListBox"
                        Grid.ColumnSpan="2" Visibility="Collapsed"
                        HorizontalAlignment="Left" VerticalAlignment="Top"
                        CanAutocompleteSelectItems="True" IsTextSearchEnabled="True" TextSearchMode="Contains" TextPath="Name"
                        ItemTemplate="{StaticResource AutoCompleteListBoxTemplate}"
                        ItemsSource="{Binding autoCompleteListItems}"
                        MouseDoubleClick="radListBox_MouseDoubleClick" MouseUp="radListBox_MouseUp">
            <DropShadowEffect ShadowDepth="10" Color="Gray" Opacity=".4" Direction="320" RenderingBias="Performance" />

    The ListBox uses this template:
    <DataTemplate x:Key="AutoCompleteListBoxTemplate">
    <ColumnDefinition />
    <ColumnDefinition />
    <ColumnDefinition />
    <Image Style="{StaticResource AutoCompleteListBoxIcon}" Width="10" Height="10" Margin="0,0,10,0" />
    <TextBlock Text="{Binding Name}" Grid.Column="1" HorizontalAlignment="Stretch" />
    <TextBlock Text="" Grid.Column="2" HorizontalAlignment="Right" Margin="5,0,5,0" />

    I set the ItemsSource in code behind:
    private void radRichTextBox_Loaded(object sender, RoutedEventArgs e)
        //Set Autocomplete ListBox itemssource
        radListBox.ItemsSource = autoCompleteListItems;

    The documentation does state the following:
    RadListBox has full autocomplete support - while the control is focused, you can type certain keys and the listbox will select the relative match for the currently typed text. 

    I'm building a RichTextBox Intellisense application, thus the ListBox is the Intellisense. The application is setup to always send focus back to the RichTextBox so that the user can continue typing.

    Is it possible to set the ListBox AutoComplete text in code behind? i.e. when the user types text in the RadRichText box, the text they type is used to set AutoComplete the ListBox.

    I've tried setting the TypedText property:
    listBox.TypedText = "He";

    However this doesn't seem to do anything.

    Thank you very much,


  2. Ivo
    Ivo avatar
    390 posts

    Posted 10 May 2012 Link to this post


    Thank you for your feedback.

    We successfully reproduced this at our side. You can track this issue's status into our PITS here. We will do our best to fix this for one of our future releases.

    I have also updated your Telerik points.

    the Telerik team

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

  3. DevCraft R3 2016 release webinar banner
  4. Robert
    Robert avatar
    271 posts
    Member since:
    Mar 2011

    Posted 10 May 2012 Link to this post


    Thanks for letting me know. 

Back to Top