void ReloadCollectionView() { var sections = new Collection <ChipSection>() { new ChipSection( NSBundle.MainBundle.LocalizedString("filter_school_section_title", ""), ViewModel.Schools, ViewModel.ToggleSchoolBookmarkAtIndex ), new ChipSection( NSBundle.MainBundle.LocalizedString("filter_school_class_section_title", ""), ViewModel.SchoolClasses, ViewModel.ToggleSchoolClassBookmarkAtIndex ), new ChipSection("Lehrer", new ObservableCollection <ChipViewModel>(), null) }; // TODO: observe teacher for changes (make an observable with a static list?) foreach (ChipGroupViewModel teacherGroup in ViewModel.TeacherGroups) { sections.Add(new ChipSection(teacherGroup.Name, teacherGroup.TeacherViewModels, null)); } DataSource = new ChipCollectionViewDataSource(CollectionView, sections); Delegate = new ChipCollectionViewDelegate(sections); CollectionView.DataSource = DataSource; CollectionView.Delegate = Delegate; CollectionView.ReloadData(); }
public override void ViewDidLoad() { base.ViewDidLoad(); ViewModel = new NewSchoolClassesViewModel(); var sections = new Collection <ChipSection>() { new ChipSection( null, ViewModel.SchoolClasses, ViewModel.ToggleSchoolClassBookmarkAtIndex ) }; SchoolClassesDataSource = new ChipCollectionViewDataSource(CollectionView, sections); CollectionView.DataSource = SchoolClassesDataSource; SchoolClassesDelegate = new ChipCollectionViewDelegate(sections); CollectionView.Delegate = SchoolClassesDelegate; TitleLabel.Text = NSBundle.MainBundle.LocalizedString("new_school_classes_title", ""); SubTitleLabel.Text = NSBundle.MainBundle.LocalizedString("new_school_classes_subtitle", ""); DoneButtonLabel.Text = NSBundle.MainBundle.LocalizedString("new_school_classses_done_button", ""); }