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

SfAutoComplete > Performance issue with event OnFilterCollectionChanged on IOS

Hello , 

Im Using Autocomplete Control to filter my entrys of my listview.

The Performance issue is on IOS 11.2+ , Simulator and device.
If entering Letters in the autocomplete box to Filter my Listview (items) with the event OnFilterCollectionChanged the entered letters are not showing or stucking.

Is the using of the event correct for this situation? or use better a more performant event ?
is there a other solution to filter a list of the filtered elements in autocomplete ?

My list Items contains in the test situation only 2 contacts.

Viewmodel:

'
public ObservableCollection<Kontakt> Items { get; set; }

private void SfAutoComplete_OnFilterCollectionChanged(object sender, FilterCollectionChangedEventArgs e)
        {
            var list = (IEnumerable<object>) e.Value;
            var list2 = list.Cast<Kontakt>().ToList();

            if (list2.Count != 0)
                _viewModel.Items = new ObservableCollection<Kontakt>(list2);
            else
                _viewModel.LoadItemsCommand.Execute(null);
        }
'

xaml:
'
<SfAutoComplete TextColor="{StaticResource NavigationPrimary}"
                                    IndicatorTextColor="{StaticResource NavigationPrimary}"
                                    NoResultsFoundTextColor="LightGray"
                                    HighlightedTextColor="{StaticResource NavigationPrimary}"
                                    WatermarkColor="LightGray"
                                    ClearButtonColor="DarkGray"
                                    DropDownTextColor="DarkGray"
                                    SuggestionMode="Contains"
                                    MaximumSuggestion="3"
                                    Watermark="Suchen"
                                    NoResultsFoundText="Kein Kontakt gefunden"
                                    LoadMoreText="Mehr anzeigen"
                                    TextHighlightMode="FirstOccurrence"
                                    DisplayMemberPath="Name" 
                                    DataSource="{Binding Items}"
                                    HeightRequest="40"
                                    SuggestionBoxPlacement="None"
                                    FilterCollectionChanged="SfAutoComplete_OnFilterCollectionChanged"/>
'




1 Reply

HM Hemalatha Marikumar Syncfusion Team November 11, 2019 10:44 AM UTC

Hi Johannes,

Greetings from Syncfusion.
 
 
We have prepared the sample by loading the SfAutoComplete’s FilteredItems as collection of ListView and that has been loaded fine with better performance. Please have the sample from the below link,

Sample Linkhttps://www.syncfusion.com/downloads/support/directtrac/general/ze/AutoComplete_148943-343888824
 
 
Code Snippet[XAML]: 
 <autoComplete:SfAutoComplete  
                                                       x:Name="autoComplete"  
                                                        ……… 
                                                       FilteredItems="{Binding FilteredCollection, Mode=TwoWay}"
                                                       DataSource="{Binding EmployeeCollection}" />

 
        <ListView Grid.Row="1" x:Name="listView"  
                                                ItemsSource="{Binding FilteredCollection}"> 
            <ListView.ItemTemplate> 
                <DataTemplate> 
                    <ViewCell> 
                        <Label Text="{Binding}"  
                                    VerticalOptions="Center"  
                                    Margin="10,0,0,0"  
                                    FontSize="15"  
                                    FontAttributes="Bold" /> 
                    </ViewCell> 
                </DataTemplate> 
            </ListView.ItemTemplate> 
       </ListView> 


 
Since we are not aware of your exact application scenario, therefore, we ask you to try our sample and may you kindly revert to us by changing the sample depending on your request along with the replication steps. 

 
Regards, 
Hemalatha M. 


Loader.
Up arrow icon