How do I specify the search mode?

Jul 27, 2015 at 8:25 PM
Does this autocomplete box support setting the filter mode to either 'starts with' ,'contains' or 'exact'?. I need to be able to bind it so that it could be dynamically switched using radio buttons.
Jul 27, 2015 at 8:39 PM
No, but You can easily build in, because You return collection as suggestions:

For example if Yours suggestions looks like this:
 public SuggestionProvider suggestionProvider
       {
           get
           {
               return new SuggestionProvider(x =>
               {
                   ObservableCollection<client>  suggestions = getClients().Result;
                   
                   return suggestions.Where(o => o.name.Trim().ToUpper().Contains(x.Trim().ToUpper()) || o.city.Trim().ToUpper().Contains(x.Trim().ToUpper()));
               });
           }
       }    
You can add bool properties and bind radiobuttons to them:
public bool startsWith { get; set; }
public bool contains { get; set; }
and change suggestion provider to:
public SuggestionProvider suggestionProvider
       {
           get
           {
               return new SuggestionProvider(x =>
               {
                   ObservableCollection<client>  suggestions = getClients().Result;
                   
                if (startsWith)
                    return suggestions.Where(o => o.name.Trim().ToUpper().StartsWith(x.Trim().ToUpper()) || o.city.Trim().ToUpper().StartsWith(x.Trim().ToUpper()));
                else if(contains)
                    return suggestions.Where(o => o.name.Trim().ToUpper().Contains(x.Trim().ToUpper()) || o.city.Trim().ToUpper().Contains(x.Trim().ToUpper()));
               });
           }
       }