This is a migrated thread and some comments may be shown as answers.

AutocompleteBox Text Disable

1 Answer 230 Views
AutoCompleteBox
This is a migrated thread and some comments may be shown as answers.
Minh
Top achievements
Rank 1
Minh asked on 13 Jan 2016, 04:27 PM

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? 

1 Answer, 1 is accepted

Sort by
0
Nasko
Telerik team
answered on 15 Jan 2016, 11:06 AM
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.

Regards,
Nasko
Telerik
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
Tags
AutoCompleteBox
Asked by
Minh
Top achievements
Rank 1
Answers by
Nasko
Telerik team
Share this question
or