Category / Section
How to Open the popup when it SfAutcomplete get focused
1 min read
Syncfusion Autocomplete in Xamarin provides SuggestionOnFocus property. It makes the user to know content in the list.
To Show popup in Autocomplete when it get focused follow the below given procedure:
Step 1: Create the autocomplete sample with all necessary assemblies.
Step 2: Create a class Countrylist, and create an instance for list called countryList and then add the countries in the list using the function Add ().
Step 3: Set ShowSuggestionOnFocus True, to make the Autocomplete list popup when it gets focused.
The below code illustrates the way to achieve this.
Code snippet:
namespace Autocomplete { public partial class AutocompletePage : ContentPage { public AutocompletePage() { InitializeComponent(); //Initialize the autocomplete control. SfAutoComplete autocomplete = new SfAutoComplete(); autocomplete.ShowSuggestionsOnFocus = true;//Popup open when autocomplete is focused //List to be shown in the autocomplete control List<string> countryList = new List<string>(); countryList.Add("Uganda"); countryList.Add("Ukraine"); countryList.Add("United States"); countryList.Add("United Kingdom"); countryList.Add("Uzbekistan"); autocomplete.AutoCompleteSource = countryList; autocomplete.Watermark=”Enter Text”; //Layout for the autocomplete control StackLayout autocompleteLayout = new StackLayout(); autocompleteLayout.Padding = new Thickness(50, 100, 50, 0); autocompleteLayout.Children.Add(autocomplete); Content = autocompleteLayout; } } }
Image for Popup enabled when Autocomplete get focused: