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

Mixed tokens and text

1 Answer 112 Views
AutoCompleteBox
This is a migrated thread and some comments may be shown as answers.
Nick
Top achievements
Rank 1
Nick asked on 05 Feb 2015, 08:44 PM
I am trying to make a RadAutoCompleteBox behave similarly to the Outlook recipient fields with auto-completion of contacts. The field should allow for mixed tokens and text, while preserving the ability to search for additional autocomplete items. However, despite how I am filtering, new autocomplete items wipe out the entire SearchText.I have also tried using the SelectionChanged and SearchTextChanged events to preserve the SearchText and reassemble the non-autocomplete text after the events, but the full SearchText string is still emptied.

Is there a way to have the RadAutoCompleteBox have the above functionality?

1 Answer, 1 is accepted

Sort by
0
Nasko
Telerik team
answered on 09 Feb 2015, 03:15 PM
Hi Nick,

We are not exactly sure that we completely understand you scenario. Could you please provide us some more detailed information about the desired functionality - what is expected to be visualized inside RadAutoComplete's TextBox as soon as a selection is made? 

What we could suggest you in order to preserve the SearchText is to bind it inside the ViewModel and when the new value is an empty string to set the current SearchText to another property:

public string PreservedSearchText { get; set; }
 
private string searchText;
 
public string SearchText
{
    get
    {
        return this.searchText;
    }
    set
    {
        if (this.searchText != value)
        {
            if(value == String.Empty)
            {
                this.PreservedSearchText = this.searchText;
            }
 
            this.searchText = value;
            this.OnPropertyChanged(() => this.SearchText);
        }
    }
}

We're looking forward to hearing from you.

Regards,
Nasko
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
AutoCompleteBox
Asked by
Nick
Top achievements
Rank 1
Answers by
Nasko
Telerik team
Share this question
or