Xamarin.Forms Autocomplete CrossPlatform

Manoj Sethi picture Manoj Sethi · Jul 17, 2016 · Viewed 26.2k times · Source

I am a newbie to Xamarin.Forms Platform. I hope you can help me in moving ahead. I want to have a control like autocomplete in xamarin.forms like below

Autocomplete
(source: codetheory.in)

Can you please guide how can it be achievable in Xamarin.Forms? I want to achieve it with the Entry Control

TIA

Answer

Imdad picture Imdad · Jul 17, 2016

You haven't included what exactly you want, just some sort of autocomplete.

I'll bullet point the Manual way to do it in general for a List of items:

  1. Use a TextBox to allow the user to input text.
  2. Use a List to gather all your objects together with their searchable property such as the object Name.
  3. As the user types something in the TextBox, the app should search in the List for the String entered in the TextBox.
  4. The suggestions should be displayed, according to the String value typed, in a ListView under the TextBox.
  5. User clicks on the ListView item, which is a suggestion, and then that autocompletes by taking the object Name from the item clicked on, to the TextBox.

A general way of doing autocomplete without the long rough procedure above is to use the Android AutoCompleteTextView.

You can still use the basic logic to do it in Xamarin Forms.

Look here for the AutoCompleteTextView for Android. Look here, here and here for help with AutoComplete in Xamarin Forms.