I want to find out why C#+WPF ended the window.

Asked 2 years ago, Updated 2 years ago, 90 views

  • Developing apps with C#+WPF
  • The app consists of a main window and multiple subwindows
  • Set ShutdownMode="OnMainWindowClose" in App.yaml
  • Consider two situations:
    • Sub-window closed alone
    • The main window is closed, so the subwindow is closed
  • Is there a way to determine the above two situations?
    • If possible, I would like to know the results using the methods in the sub-window
  • Sub-window closed alone
  • The main window is closed, so the subwindow is closed
  • If possible, I would like to know the results using the methods in the sub-window

c# wpf

2022-09-30 21:22

1 Answers

If the main window closes, the Application.Current.MainWindow property is null.


2022-09-30 21:22

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.