Autocomplete TextField With Suggestion Dropdown In Xamairn.Forms

The Xamarin.Forms Autocomplete control is highly optimized to quickly load and populate suggestions from a large volume of data depending on the user’s input characters. The Autocomplete control allows the user to select one or more items from the suggestion list.

First, create the Xamarin forms project and then update the all Nuget packages in your project.
 
Write this code in your MainPage.Xaml, 
  1. <AbsoluteLayout>  
  2.         <Entry TextChanged="SearchBar_OnTextChanged" BackgroundColor="#f9f9f9" TextColor="#FF464859" FontSize="16" PlaceholderColor="#646b7a" x:Name="searchBar" Placeholder="Type here..." AbsoluteLayout.LayoutBounds="15,70,285,38" AbsoluteLayout.LayoutFlags="None"/>  
  3.         <ListView x:Name="countryListView" IsVisible="False"   CachingStrategy="RecycleElement" BackgroundColor="White" ItemTapped="ListView_OnItemTapped" AbsoluteLayout.LayoutBounds="20,110,269,160" AbsoluteLayout.LayoutFlags="None">  
  4.             <ListView.ItemTemplate>  
  5.                 <DataTemplate>  
  6.                     <ViewCell>  
  7.                         <Frame>  
  8.                             <StackLayout BackgroundColor="White">  
  9.                                 <Label Text="{Binding .}" FontSize="16" TextColor="#FF464859"/>  
  10.                             </StackLayout>  
  11.                         </Frame>  
  12.                     </ViewCell>  
  13.                 </DataTemplate>  
  14.             </ListView.ItemTemplate>  
  15.         </ListView>  
  16.     </AbsoluteLayout>  
And then write some code in MainPage.Xaml.cs class,
 
Initial declared ObservableCollection, 
  1. ObservableCollection<string> data = new ObservableCollection<string>();  
then add values in ObservableCollection through method,
  1. public async void ListOfStore() //List of Countries  
  2.        {  
  3.            try  
  4.            {  
  5.                data.Add("Afghanistan");  
  6.                data.Add("Austria");  
  7.                data.Add("Australia");  
  8.                data.Add("Azerbaijan");  
  9.                data.Add("Bahrain");  
  10.                data.Add("Bangladesh");  
  11.                data.Add("Belgium");  
  12.                data.Add("Botswana");  
  13.                data.Add("China");  
  14.                data.Add("Colombia");  
  15.                data.Add("Denmark");  
  16.                data.Add("Kmart");  
  17.                data.Add("Pakistan");  
  18.            }  
  19.            catch (Exception ex)  
  20.            {  
  21.                await DisplayAlert(""""+ex, "Ok");  
  22.            }  
  23.        }  
And now call this method ListOfStore() in Constructor,
  1. public MainPage()  
  2.      {  
  3.          InitializeComponent();  
  4.          ListOfStore();  
  5.      }  
Now we create SearchBar_OnTextChanged method in MainPage.xaml.cs class,
  1. private void SearchBar_OnTextChanged(object sender, TextChangedEventArgs e)  
  2.       {  
  3.           countryListView.IsVisible = true;  
  4.           countryListView.BeginRefresh();  
  5.   
  6.           try  
  7.           {  
  8.               var dataEmpty = data.Where(i => i.ToLower().Contains(e.NewTextValue.ToLower()));  
  9.   
  10.               if (string.IsNullOrWhiteSpace(e.NewTextValue))  
  11.                   countryListView.IsVisible = false;  
  12.               else if (dataEmpty.Max().Length == 0)  
  13.                   countryListView.IsVisible = false;  
  14.               else  
  15.                   countryListView.ItemsSource = data.Where(i => i.ToLower().Contains(e.NewTextValue.ToLower()));  
  16.           }  
  17.           catch (Exception ex)  
  18.           {  
  19.               countryListView.IsVisible = false;  
  20.   
  21.           }  
  22.           countryListView.EndRefresh();  
  23.   
  24.       }  
Now we create ItemTapped method in MainPage.xaml.cs class,
  1. private void ListView_OnItemTapped(Object sender, ItemTappedEventArgs e)  
  2.      {  
  3.          //EmployeeListView.IsVisible = false;  
  4.   
  5.          String listsd = e.Item as string;  
  6.          searchBar.Text = listsd;  
  7.          countryListView.IsVisible = false;  
  8.   
  9.          ((ListView)sender).SelectedItem = null;  
  10.      }  
Here is the full code,
  1. ObservableCollection<string> data = new ObservableCollection<string>();  
  2.   
  3.        public MainPage()  
  4.        {  
  5.            InitializeComponent();  
  6.            ListOfStore();  
  7.        }  
  8.   
  9.        public async void ListOfStore() //List of Countries  
  10.        {  
  11.            try  
  12.            {  
  13.                data.Add("Afghanistan");  
  14.                data.Add("Austria");  
  15.                data.Add("Australia");  
  16.                data.Add("Azerbaijan");  
  17.                data.Add("Bahrain");  
  18.                data.Add("Bangladesh");  
  19.                data.Add("Belgium");  
  20.                data.Add("Botswana");  
  21.                data.Add("China");  
  22.                data.Add("Colombia");  
  23.                data.Add("Denmark");  
  24.                data.Add("Kmart");  
  25.                data.Add("Pakistan");  
  26.            }  
  27.            catch (Exception ex)  
  28.            {  
  29.                await DisplayAlert(""""+ex, "Ok");  
  30.            }  
  31.        }  
  32.        private void SearchBar_OnTextChanged(object sender, TextChangedEventArgs e)  
  33.        {  
  34.            countryListView.IsVisible = true;  
  35.            countryListView.BeginRefresh();  
  36.   
  37.            try  
  38.            {  
  39.                var dataEmpty = data.Where(i => i.ToLower().Contains(e.NewTextValue.ToLower()));  
  40.   
  41.                if (string.IsNullOrWhiteSpace(e.NewTextValue))  
  42.                    countryListView.IsVisible = false;  
  43.                else if (dataEmpty.Max().Length == 0)  
  44.                    countryListView.IsVisible = false;  
  45.                else  
  46.                    countryListView.ItemsSource = data.Where(i => i.ToLower().Contains(e.NewTextValue.ToLower()));  
  47.            }  
  48.            catch (Exception ex)  
  49.            {  
  50.                countryListView.IsVisible = false;  
  51.   
  52.            }  
  53.            countryListView.EndRefresh();  
  54.   
  55.        }  
  56.   
  57.   
  58.        private void ListView_OnItemTapped(Object sender, ItemTappedEventArgs e)  
  59.        {  
  60.            //EmployeeListView.IsVisible = false;  
  61.   
  62.            String listsd = e.Item as string;  
  63.            searchBar.Text = listsd;  
  64.            countryListView.IsVisible = false;  
  65.   
  66.            ((ListView)sender).SelectedItem = null;  
  67.        }  
  68.   
  69.    }  
Here is a simple screenshot,
 
Autocomplete TextField With Suggestion Dropdown In Xamairn.Forms