Highlight Text in RadAutocompleteTextBox

3 posts, 0 answers
  1. Ke
    Ke avatar
    11 posts
    Member since:
    Mar 2013

    Posted 13 Jan 2014 Link to this post

    Hi There,
    Is there a way to force select all text in a RadAutocompleteTextBox? I tried to set IsHighlighted = true but it didn't work.

    Thanks,
    Ke
  2. Kalin
    Admin
    Kalin avatar
    1208 posts

    Posted 16 Jan 2014 Link to this post

    Hello Ke,

    In order to select all the text you will need to get the TextBox which contains the text and call its SelectAll method. If you are doing this on button click, the handler should look like following:

    private void Button_Click(object sender, RoutedEventArgs e)
    {
        this.Auto.Focus();
        (this.Auto.ChildrenOfType<TextBox>().First() as TextBox).SelectAll();
    }

    Firstly you will need to focus the AutoCompleteBox to be able to select all the text.

    Hope this helps.

    Regards,
    Kalin
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  3. UI for WPF is Visual Studio 2017 Ready
  4. Ke
    Ke avatar
    11 posts
    Member since:
    Mar 2013

    Posted 24 Jan 2014 Link to this post

    works like a charm! thanks a lot!
Back to Top