Articles in this section
Category / Section

How to change suggestion mode based on search criteria?

1 min read

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 an instance for AutoComplete.

Step 3: Create an instance for List and populate it using Add() function.

Step 4: Then assign the populated list to AutoComplete’s AutoCompleSource property.

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

C#

 
public partial class AutoCompletePage : ContentPage    {        SfAutoComplete autoComplete;        public AutoCompletePage()        {            InitializeComponent();            autoComplete = new SfAutoComplete();           autoComplete .SuggestionMode = SuggestionMode.Contains;
            List<string> list = new List<string>();           list .Add("Afghanistan");
           list .Add("Akrotiri");
           list .Add("Albania");
           list .Add("Algeria");
            autoComplete.AutoCompleteSource = list;            StackLayout stack = new StackLayout();            stack.Children.Add(autoComplete);            this.Content = stack;        }    }

 

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

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