public ViewModel7357() { for (var i = 0; i < 50; i++) { var model = new Model7357 { Text = "Item " + i }; if (i == 49) { model.BackgroundColor = Color.Pink; } ItemsSource.Add(model); } }
async void CollectionView_RemainingItemsThresholdReached(object sender, System.EventArgs e) { if (_isUpdatingSource) { return; } await _semaphoreSlim.WaitAsync(); try { _isUpdatingSource = true; var itemsSource = ((sender as CollectionView).ItemsSource as ObservableCollection <Model7357>); var count = itemsSource.Count; if (count == 100) { return; } for (var i = count; i < count + 50; i++) { var model = new Model7357 { Text = "Item " + i }; if (i == 99) { model.BackgroundColor = Color.Pink; } itemsSource.Add(model); } } finally { _semaphoreSlim.Release(); _isUpdatingSource = false; } }