Ejemplo n.º 1
0
        //private void Btn_PickOne_Click(object sender, RoutedEventArgs e)
        //{
        //    Lbx_Students.SelectedItem = null;
        //    var cnt = App._students.Count(x => x.picked);
        //    do
        //    {
        //        canditate = App._students[ rnd.Next(studentsCnt)];
        //    } while (cnt < studentsCnt && canditate.picked);

        //    //if (!canditate.picked)

        //}

        private void Btn_Add_Click(object sender, RoutedEventArgs e)
        {
            Student stud = new Student {
                firstName = "please edit", lastName = "please edit", matNumber = Math.Abs(Guid.NewGuid().GetHashCode()).ToString()
            };

            App._students.Add(stud);
            Lbx_Students.SelectedItem = stud;
            Lbx_Students.ScrollIntoView(stud);
        }
Ejemplo n.º 2
0
        private void Btn_Add_Click(object sender, RoutedEventArgs e)
        {
            Student stud = new Student {
                firstName = "Edit...", lastName = "Edit...", matNumber = Math.Abs(Guid.NewGuid().GetHashCode()).ToString()
            };


            App._students.Add(stud);
            Lbx_Students.SelectedItem = stud;
            Lbx_Students.ScrollIntoView(stud);  // scrolled to the new student


            //Workaround
            //Lbx_Students.ItemsSource = null;
            //Lbx_Students.ItemsSource =App._students
        }