SfAutocomplete Mvvm Value Changed BInding

Hi

I am facing some implementation issues of SfAutocomplete and unable to figure out the solution.
for my project there we need implementation Autocomplete. Here the suggestion is loaded dynamically according to the user input. 
Here data fetching need to be started once the user enters more than 3 characters. According to the input server returns the related data. How can we implement the above feature with mvvm(viewmodel).

Thanks in advance.
Ajit



3 Replies

AS Anandraj Selvam Syncfusion Team February 20, 2020 12:26 PM UTC

Hi Ajith Gopalakrishnan, 
  
Greetings from the Syncfusion, 
  
We would like to let you know that we have checked the reported issue and we have achieved your requirement by setting the SuggestionMode to Custom as like below code
  
Code Snippet:  
 
autocomplete.Filter = FilterSuggestions; 
 
public bool FilterSuggestions(string search, object item) 
{ 
   string text = item.ToString().ToLower(); 
   if (item != null) 
   { 
      try 
      { 
         if (search.Count() > 2) 
         { 
             return true; 
         } 
         else 
         {  
             return false; 
         } 
      } 
      catch (Exception) 
      { 
           return (text.Contains(search)); 
      } 
   } 
   else 
       return false; 
} 
  

Please revert us for further investigation. 
  
Regards, 
Anand Raj S. 



AG Ajith Gopalakrishnan February 20, 2020 01:15 PM UTC

I was wondering whether there is option to initiate search only if the auto complete text length is greater than 3? Like an replacement for valuechanged event in xaml.cs


AS Anandraj Selvam Syncfusion Team February 21, 2020 02:24 PM UTC

Hi Ajith Gopalakrishnan, 
 
Thanks for the update, 
 
We have checked your query and prepared a sample to achieve your requirement. Please find the sample from the below link.  
 
 
Please revert us for further investigation. 
 
Regards, 
Anand Raj S. 


Loader.
Up arrow icon