// Двойное нажатие ЛЕВОЙ кнопки на строку. Нужно редактировать объект Schedule в строке. private void Row_DoubleClick(object sender, MouseButtonEventArgs e) { if (e.ChangedButton == MouseButton.Left) { DataGridRow row = sender as DataGridRow; Schedule obj = ((FrameworkElement)sender).DataContext as Schedule; ScheduleItemWindow window = new ScheduleItemWindow(currentTerm, this, obj); window.ShowDialog(); } e.Handled = true; }
// Редактируем объект Schedule. private void EditeRow_Click(object sender, RoutedEventArgs e) { try { Schedule obj = ((FrameworkElement)sender).DataContext as Schedule; ScheduleItemWindow window = new ScheduleItemWindow(currentTerm, this, obj); window.ShowDialog(); updateScheduleList(); } catch (Exception ex) { Console.WriteLine("{0} Exception caught", ex); } }
// Добавляем объект Schedule. private void btnAddNewScheduleRow_Click(object sender, RoutedEventArgs e) { ScheduleItemWindow addScheduleItem = new ScheduleItemWindow(currentTerm, this); try { addScheduleItem.ShowDialog(); updateScheduleList(); } catch (Exception ex) { Console.WriteLine("{0} Exception cought", ex); } }