private void DisplayPage(int nextPage) { if (NumPages == 0) { return; } CurrentPage = nextPage; if (CurrentPage > NumPages) { CurrentPage = 1; } else if (CurrentPage < 1) { CurrentPage = NumPages; } int iFirst = ((CurrentPage - 1) * NumGroupsPerPage); int iNextPage = iFirst + NumGroupsPerPage; if (iNextPage > _allItemsToShow.Count) { iNextPage = _allItemsToShow.Count; } ItemsToShow.Clear(); for (int i = iFirst; i < iNextPage; i++) // Remember these are groups, not individual items { ItemsToShow.Add(_allItemsToShow[i]); } OnPropertyChanged("PageNumberText"); }
private void RefreshBindingSourceForChart() { // I need to show top N items sorted by Characteristic, so we use appropriate comparer for sorting _tables.Sort(GetComparer()); _tables.Reverse(); // and linq to select items needed List <TableInfoViewItem> items = _tables .Take(NumValues.Value) .Select(x => new TableInfoViewItem(x, _characteristicToDisplay)) .ToList(); ItemsToShow.Clear(); foreach (TableInfoViewItem item in items) { ItemsToShow.Add(item); } }
public VwSelectStringsFromList(IDictionary <string, /*selected*/ bool> itemsAndSelections, string title, string subTitle, Func <IDictionary <string, /*selected*/ bool>, bool /*Result: not used*/> okCallback) { InitializeComponent(); DisplayTitle = title; DisplaySubTitle = subTitle; OkCallback = okCallback; foreach (var item in itemsAndSelections) { ItemsToShow.Add(new DisplayItem() { TextToDisplay = item.Key, IsSelected = item.Value, }); } this.BindingContext = this; }
void UpdateShownItems() { ItemsToShow.Clear(); if (Feeds == null || Feeds.Count <= 0) { ListViewPlaceholderText = "No Feeds Available"; return; } foreach (var item in Feeds.SelectMany(f => f.GetItemsBySearchTerm(SearchTerm))) { ItemsToShow.Add(item); } if (ItemsToShow.Count <= 0) { ListViewPlaceholderText = "No Feeds to Show"; } else { ListViewPlaceholderText = string.Empty; } }