private void InitializeStudents() { NamesTable.Clear(); Backup.Clear(); if (InGrade.Count == 0 && TeachersInGrade.Count == 0) { NotFoundStack.IsVisible = true; } else { NotFoundStack.IsVisible = false; } int count = 0; string filter = StudentSearch.Text == null ? "" : StudentSearch.Text.Trim().ToLower(); foreach (var s in InGrade) { ViewCell cell = new ViewCell() { Height = 70 }; StackLayout sl = new StackLayout() { Orientation = StackOrientation.Horizontal, BackgroundColor = Color.FromHex("#FFFFFF") }; sl.Padding = new Thickness(10, 0, 10, 0); sl.Children.Add(new Label() { Text = s.Key, IsVisible = false }); CircleImage ci = GetPhoto(s, true); sl.Children.Add(ci); CheckBox cb = new CheckBox() { HorizontalOptions = LayoutOptions.EndAndExpand }; Label l = new Label() { Text = s.Value, VerticalOptions = LayoutOptions.Center, VerticalTextAlignment = TextAlignment.Center, TextColor = Color.Black, FontSize = 16, Padding = new Thickness(30, 0, 0, 0) }; cell.Tapped += TableCell_Tapped; sl.Children.Add(l); sl.Children.Add(cb); cell.View = sl; Backup.Add(cell); if (Attendance.AttendedToday(s.Key, DatePicker.Date)) { cb.IsChecked = true; } else { cb.IsChecked = false; } if (s.Value.ToLower().Contains(filter)) { // make visible NamesTable.Add(cell); count++; } } //NamesTableRoot.Clear(); NamesTableRoot.Add(NamesTable); }