I'm using simple listview in xamarin forms and populate data from sqlite database, here is big performance problem for IOS , but for android it works great. here is bit code of my listview:
ListView listView = new ListView {
VerticalOptions = LayoutOptions.Start,
HorizontalOptions = LayoutOptions.Start
};
listView.SetBinding (ListView.ItemsSourceProperty, SearchViewModel.ProductsPropertyName);
listView.ItemTemplate = new DataTemplate (typeof(SearchItemCell));
listView.HasUnevenRows = true;
listView.ItemSelected += async (sender, e) => {
if (e.SelectedItem == null)
return;
_viewModel.AddProductToCart ((Product)e.SelectedItem);
Navigation.PopAsync ();
};
I populate data inside OnAppearing method
protected override async void OnAppearing ()
{
base.OnAppearing ();
if (_viewModel.Products == null) {
Loading loadingScreen = new Loading (true);
await Navigation.PushModalAsync (loadingScreen);
await Task.Run (() => {
_viewModel.LoadData ();
});
await Navigation.PopModalAsync ();
}
}