public void ApplySelectedFilter(SearchItems filter) { this.SelectedFilter = filter; foreach (string brand in filter.Brands) { CheckBoxItemBrands item = Brands.FirstOrDefault(i => i.ID == brand); if (item != null) { item.IsChecked = true; } } foreach (Color color in filter.Colors) { var item = Colors.FirstOrDefault(i => i.color == color); if (item != null) { item.IsChecked = true; } } ApplyPropertyFilters(Styles, filter.Styles); ApplyPropertyFilters(Necklines, filter.Necklines); ApplyPropertyFilters(Silhouettes, filter.Silhouettes); SelectedMinPrice = filter.SelectedMinPrice ?? MinPrice; SelectedMaxPrice = filter.SelectedMaxPrice ?? MaxPrice; }
void AddBrands(List <Brand> brands) { foreach (Brand brand in brands) { var item = new CheckBoxItemBrands() { ID = brand.Name, Display = brand.Name, IsChecked = false }; Brands.Add(item); } }