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. Image for the cookie policy date

AutoSuggest not working

I am trying to implement the AutoSuggest but doesn't seem to be working

I have a List<string> with more than 6000 records that I have bound to a control and it doesn't auto suggest

Here is my XAML
<Syncfusion:SfTextBoxExt Grid.Column="1" Grid.Row="8" x:Name="City"  Margin="10,0,0,10" AutoCompleteSource="{Binding Cities}" AutoCompleteMode="Suggest" SuggestionMode="StartsWith" SearchItemPath="" Text="{Binding FamilyMember.City, Mode=TwoWay, NotifyOnValidationError=True, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}" Validation.Error="Validation_Error"/>

I can swear that Cities object is available on this user control.

I am also looking for two events for this textbox where user either completes typing on a text box and moves away from this field and also if they select from suggested items. I then want to populate State and Country from that typed or selected value.


4 Replies

MS Mariappan S Syncfusion Team January 13, 2017 09:00 AM UTC

Hi Andy,   
Thank you for contacting Syncfusion Support.  
We have checked your code example. In this code example, you set SearchItemPath as empty so it doesn’t search the given text. We have prepared sample that meets your requirement. In this sample, we have populated Cities collection in the SfTextBoxExt control and shown the “State” and “Country” based on SfTextBoxExt selection.   
Please download the sample from the below location.   
Sample link: SfTextBoxExtSample
If your requirement differs from this sample, please provide more information about your requirement that would help to proceed further.   

AJ Andy Johnson January 13, 2017 02:29 PM UTC

Hi Mariappan,
I looked at your solution. But as I mentioned, I am using the List<string> as cities. My cities is not a list<object> where I can define the SearchItemPath. That is why I kept the SearchItemPath empty since I don't have it in List<string>

It really means that, I can not use the simple list to populate AutoSuggest? If not, I can modify my code to get the List<object> and define SearchItemPath in my XAML. That is not a big issue.

Also, I am looking for two triggers
  1. When user selects the suggested option from the listt
  2. When no match from suggestion and user types in the field and focus is lost from that field(onBlur. I am sorry but I am coming from web development background)

Can you please show me those two triggers MVVM way?

AJ Andy Johnson January 14, 2017 01:02 AM UTC

Mariappan ,
Finally I made it work. My problem was that I was not using the ObservableCollection in my ViewModel to declare and initialize the List of Cities. And another thing is that, I started using the collection instead of List<string>.
I also managed to use the Event "SelectionChanged" which behaves like KeyUp and seems enough for me.

Thanks for all your help

KJ Keerthana Jegannathan Syncfusion Team January 16, 2017 04:03 AM UTC

Hi Andy, 
Thank you for your update. 
Please let us know if you need further assistance on this. 
Keerthana J 

Live Chat Icon For mobile
Up arrow icon