예제 #1
0
        private void CreateStudent_Click(object sender, RoutedEventArgs e)
        {
            var selectedIndex = StudentsListBoxView.SelectedIndex;

            if (selectedIndex == -1)
            {
                var studentEditor = new StudentEditor();
                studentEditor.Show();
            }
        }
예제 #2
0
        private void StudentsListView_DoubleClick(object sender, MouseEventArgs e)
        {
            var selectedIndex   = StudentsListBoxView.SelectedIndex;
            var studentsListBox = e.Source as ListBoxItem;
            var item            = ((FrameworkElement)e.OriginalSource).DataContext as Student;
            var selectedStudent = StudentsListBoxView.Items.GetItemAt(selectedIndex) as Student;
            var studentEditor   = new StudentEditor(selectedStudent);

            studentEditor.Owner = Application.Current.MainWindow;
            studentEditor.Show();
        }