private void UpdateListContent() { _expandedGroups = new ObservableCollection <FoodGroup>(); foreach (FoodGroup group in _allGroups) { FoodGroup newGroup = new FoodGroup(group.Title, group.ShortName, group.Expanded); newGroup.FoodCount = group.Count; if (group.Expanded) { foreach (Food food in group) { newGroup.Add(food); } } _expandedGroups.Add(newGroup); } GroupedView.ItemsSource = _expandedGroups; }
private void UpdateListContent() { _expandedGroups = new ObservableCollection <FoodGroup>(); foreach (FoodGroup group in _allGroups) { //Create new FoodGroups so we do not alter original list FoodGroup newGroup = new FoodGroup(group.Title, group.ShortName, group.Expanded); //Add the count of food items for Lits Header Titles to use newGroup.FoodCount = group.Count; if (group.Expanded) { foreach (Food food in group) { newGroup.Add(food); } } _expandedGroups.Add(newGroup); } GroupedView.ItemsSource = _expandedGroups; }