private async void RefreshListView(bool updateGroupsCounts = false) { if (updateGroupsCounts) { foreach (GroupsPageItem group in _itemsList) { ObservableCollection <ContactModel> groupContacts = new ObservableCollection <ContactModel>(HomePage.ContactCollection.Where(x => !string.IsNullOrEmpty(x.Group) && x.Group.Equals(group.GroupName))); group.Count = groupContacts.Count; } } // order collection items by group name _filteredItemsList = SortGroups(); if (!string.IsNullOrWhiteSpace(mainSearchBar.Text)) { _filteredItemsList = await Task.Factory.StartNew(() => SearchGroups(mainSearchBar.Text)); } GroupsListView.ItemsSource = null; GroupsListView.ItemsSource = _filteredItemsList; ResizeGroupsGridToFit(); IEnumerable <GroupsPageItem> selectedItems = _filteredItemsList.Where(x => x.IsSelected); if (selectedItems != null && selectedItems.Count() > 0) { _selectedGroupName = selectedItems.ElementAt(0).GroupName; if (Device.IsInvokeRequired) { Device.BeginInvokeOnMainThread(() => { GroupsListView.ScrollTo(selectedItems.ElementAt(0), ScrollToPosition.Center, true); }); } else { GroupsListView.ScrollTo(selectedItems.ElementAt(0), ScrollToPosition.Center, true); } } }