StudentDetailsWindow.xaml.cs 695 B

123456789101112131415161718192021222324252627282930
  1. using System.Windows;
  2. using System.Windows.Input;
  3. namespace WpfApp3.Windows
  4. {
  5. public partial class StudentDetailsWindow : Window
  6. {
  7. public Student CurrentStudent { get; set; }
  8. public StudentDetailsWindow(Student currentStudent)
  9. {
  10. InitializeComponent();
  11. CurrentStudent = currentStudent;
  12. DataContext = CurrentStudent;
  13. }
  14. private void Window_KeyDown(object sender, KeyEventArgs e)
  15. {
  16. if (e.Key == Key.Escape)
  17. {
  18. Close();
  19. }
  20. }
  21. private void OKButton_Click(object sender, RoutedEventArgs e)
  22. {
  23. Close();
  24. }
  25. }
  26. }