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.