示例#1
0
        public StudentSelector()
        {
            using (DataRepository Repo = new DataRepository())
            {
                // Get the classes
                Classes = Repo.Classes.ToList();
                // Get the names of the classes
                ClassNames = Repo.Classes.Select(c => c.ClassName).ToList();
                // Insert a "dummy" class which ignores the selection
                ClassNames.Insert(0, "All students");

                // Get the students
                Students = Repo.Users.OfType <Student>().Select(s => new Checkable <Student>(s)).ToList();
                // Initialise the filtered student list
                FilteredStudents = new ObservableCollection <Checkable <Student> >(Students);
            }

            InitializeComponent();
        }