AutocompleteBox Text Disable

2 posts, 0 answers
  1. Minh
    Minh avatar
    43 posts
    Member since:
    May 2014

    Posted 13 Jan 2016 Link to this post

    Hi, I have another function that populates the selected items from my AutocompleteBox. I want to remove the typing capabilities of my AutoCompleteBox. But I would like to still remove any items selected. 


    May I ask how would that be accomplished? 

  2. Nasko
    Nasko avatar
    727 posts

    Posted 15 Jan 2016 Link to this post

    Hello Minh,

    In order to achieve the desired by you functionality of RadAutoCompleteBox using the ChildrenOfType<T> you need to get the WaterMarkTextBox placed inside the AutoCompleteBox and set its ReadOnly property to True. Thus the TextBox part of the control will be read only (you wont' be able to type inside it) and at the same time you will be able to remove the selected items:
    private void RadAutoCompleteBox_Loaded(object sender, RoutedEventArgs e)
        var auto = sender as RadAutoCompleteBox;
        var waterMarkTextBox = auto.ChildrenOfType<RadWatermarkTextBox>().FirstOrDefault();
        if(waterMarkTextBox != null)
            waterMarkTextBox.IsReadOnly = true;

    Hope this helps.

    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 Feedback Portal and vote to affect the priority of the items
Back to Top