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

FilterCollectionChangedEventArgs e always has null value on iOS.

Hello, I have a problem with SfAutocomplete. Here is my xaml:

            <autocomplete:SfAutoComplete
                x:Name="autoCompleteSearchBar"
                AutoCompleteMode="Suggest"
                DataSource="{Binding FoodItems}"
                DisplayMemberPath="Name"
                FilterCollectionChanged="AutoCompleteSearchBar_FilterCollectionChanged"
                FilteredItems="{Binding FilteredItems, Mode=TwoWay}"
                SuggestionBoxPlacement="None"
                SuggestionMode="Contains" />

And here is my code:

        private void AutoCompleteSearchBar_FilterCollectionChanged(object sender, FilterCollectionChangedEventArgs e)
        {
            dispatcher.Debounce(500, () =>
             {
                 Device.BeginInvokeOnMainThread(() =>
                 {
                     myLlistView.ItemsSource = (IEnumerable<object>)e.Value;
                     Debug.WriteLine("Executed from Device.BeginInvokeOnMainThread on filter complete");
                 });
             });
        }
    }

On iOS the e.Value object is always null but it works fine on UWP. I can't test it on Android at the moment. To get around the issue I've replaced e.Value with autoCompleteSearchBar.FilteredItems. 

On a side note, does SfAutoComplete not have an option to only change the FilteredItems list after the user has finished inputting text ?  SfAutoComplete itself is very fast but I have another control that depends on the FilteredItems property and having it change every time the user types something makes it have to redraw too much and it lags when there are many items. I had to use the FilterChanged event to use a debouncer that will manually set the list ItemSource after a certain interval.

1 Reply

MK Muneesh Kumar G Syncfusion Team August 6, 2019 11:02 AM UTC

Hi George, 
 
Greetings from Syncfusion. 
 
We would like to let you know that the same could be achieved using FilteredItems API. Please have the sample from the below link, 
 
Code Snippet: 
 
listView.ItemsSource = (sender as SfAutoComplete).FilteredItems; 
 
 
Please check with the sample and let us know if you have any concern. 
  
Thanks, 
Muneesh Kumar G. 


Loader.
Live Chat Icon For mobile
Up arrow icon