RadAutoCompleteTextView: Getting Started

In this article, you will learn how to initialize RadAutoCompleteTextView and use it with it's basic configuration.


In order to use RadAutoCompleteTextView you need to add references to the Input, Common, List and Primitives libraries which are part of Telerik UI for Xamarin.Android.

After your project is set up and ready to use TelerikUI, you need to create an instance of RadAutoCompleteTextView. The common way to do this is to create an RauAutoCompleteTextView in the XML layout of your activity.

Then you should access the autocomplete object in your activity/fragment and populate it with data.
this.autocomplete = (RadAutoCompleteTextView)rootView.FindViewById(Resource.Id.autocmp);

Populate with data

In order to populate the autocomplete you need to create an AutoCompleteAdapter object and pass it the array of suggestions which should be TokenModel objects. The TokenModel is a unified object used by the autocomplete to represent data objects as suggestions or tokens.

We will use the following list of string for the purposes of the examples.

this.data = new List<string>() { "Australia", "Albania","Austria", "Argentina", "Maldives","Bulgaria","Belgium","Cyprus","Italy","Japan",
                            "Vatican City", "Chad", "China", "Chile" };

Then we will create TokenModel object out ot the original data array.

private List<TokenModel> GetTokenObjects()
    List<TokenModel> feedData = new List<TokenModel>();
    for (int i = 0; i < this.data.Count; i++)
        TokenModel token = new TokenModel(this.data[i], null);

    return feedData;

Finally, we will create a AutoCompleteAdapter with the list of TokenModel objects.

this.adapter = new AutoCompleteAdapter(this.Context, this.GetTokenObjects(), Java.Lang.Integer.ValueOf(Resource.Layout.suggestion_item_layout));
this.adapter.CompletionMode = CompletionMode.StartsWith;
this.autocomplete.Adapter = this.adapter;

Autocomplete is now ready to use. You can additionnaly set up its suggest and display modes according your needs.

this.autocomplete.SuggestMode = SuggestMode.Suggest;
this.autocomplete.DisplayMode = DisplayMode.Plain;


In this article
Not finding the help you need? Improve this article