Articles in this section
Category / Section

How to detect event for Enter Key press in AutoComplete?

1 min read

The SfAutoComplete completed event will triggered when clicking the enter key button.

 

Steps to detect event for Enter Key press in AutoComplete:

 

Step 1:   Add the SfAutoComplete control in the content page.

Step 2:  Add the completed event in the SfAutoComplete control.

 

The following code illustrates the way to detect event for Enter Key press in AutoComplete.

 

Xaml Code:

 

<StackLayout VerticalOptions="Start" HorizontalOptions="Start" Padding="30">
     
    <autocomplete:SfAutoComplete HeightRequest="40" x:Name="autoComplete" Completed="Handle_Completed"/>
</StackLayout>

 

 

C# Code:

 

public partial class AutoComplete135412Page : ContentPage

    {

        void Handle_Completed(object sender, System.EventArgs e)

        {

            DisplayAlert("Okay","Completed","Cancel");

        }

 

        public AutoComplete135412Page()

        {

            InitializeComponent();

   List<string> countryNames = new List<string>();

   countryNames.Add("Uganda");

   countryNames.Add("Ukraine");

   countryNames.Add("Canada");

   countryNames.Add("United Arab Emirates");

   countryNames.Add("France");

   countryNames.Add("United Kingdom");

   countryNames.Add("China");

   countryNames.Add("United States");

   countryNames.Add("Japan");

   autoComplete.DataSource = countryNames;

        }

    }

 

 

Please download the sample from the below link:

https://www.syncfusion.com/downloads/support/directtrac/general/ze/SyncfusionAutocomplete_Sample1297278964

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments
Please  to leave a comment
Access denied
Access denied