We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to change suggestion mode based on search criteria?

To change the Suggestion mode based on search criteria, follow the given steps:

Step 1: Create the AutoComplete sample and include the necessary source files.

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: Then create an instance for autocomplete. And you must set the AutoCompleteSource to Countrylist ().Country to get the list of countries.

Step 4: By using the object you can change the suggestion display as follows:

public class Countrylist

{

    List<String> countryList = new List<String>();

    public Countrylist ()

   {

      //countryList

        countryList.Add("Afghanistan");

        countryList.Add("Akrotiri");

        countryList.Add("Albania");

        countryList.Add("Algeria");

    }

    public List<String> Country

   {

        get

       {

                return countryList;

        }

   }

}

 

public class AutoComplete

{

   public AutoComplete()

   {

      SfAutoComplete countryAutoComplete = new SfAutoComplete();

      countryAutoComplete.AutoCompleteSource = new Countrylist().Country;

      countryAutoComplete.SuggestionMode = SuggestionMode.StartsWith;

      countryAutoComplete.SuggestionMode = SuggestionMode.StartsWithCaseSensitive;

      countryAutoComplete.SuggestionMode = SuggestionMode.EndsWith;

      countryAutoComplete.SuggestionMode = SuggestionMode.EndsWithCaseSensitive;

      countryAutoComplete.SuggestionMode = SuggestionMode.Contains;

      countryAutoComplete.SuggestionMode = SuggestionMode.ContainsWithCaseSensitive;

      countryAutoComplete.SuggestionMode = SuggestionMode.Equals;

      countryAutoComplete.SuggestionMode = SuggestionMode.EqualsWithCaseSensitive;

      this.Content = GetAutoComplete();

 

    }

private StackLayout GetAutoComplete()

{

    var mainStack = new StackLayout

   {

       Children ={ countryAutoComplete }

    };

       return mainStack;

 }

}

 

The following screenshot is an example to change the suggestion display mode:

StartsWith

F:\backup\carousel images\startswith.png

StartsWithCaseSensitive

F:\backup\carousel images\swcs.png

Contains

F:\backup\carousel images\c.png

 

 

 

 

ContainsWithCaseSensitive

F:\backup\carousel images\cwcs.png

Equals

F:\backup\carousel images\eq.png

EqualsWithCaseSensitive

F:\backup\carousel images\eqwcs.png

EndsWith

F:\backup\carousel images\endw.png

EndsWithCaseSensitive

F:\backup\carousel images\endwcs.png

Article ID: Published Date: Last Revised Date: Platform: Control:
7058 08/22/2016 08/22/2016 Xamarin.Forms SfAutoComplete
Did you find this information helpful?
Add Comment
You must log in to leave a comment

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon