The full sequence of events fired for a Window object are as follows.
On application startup, if the Window is the application’s main window. (Application events are also shown in the correct sequence).
- Application.Startup
- Window.Initialized
- Window.IsVisibleChanged
- Window.SizeChanged
- Window.LayoutUpdated
- Window.SourceInitialized
- Application.Activated
- Window.Activated
- Window.PreviewGotKeyboardFocus
- Window.IsKeyboardFocusWithinChanged
- Window.IsKeyboardFocusedChanged
- Window.GotKeyboardFocus
- Window.LayoutUpdated
- Window.Loaded
- Window.ContentRendered
On normal application shutdown, the event sequence is:
- Window.Closing
- Window.IsVisibleChanged
- Window.Deactivated
- Application.Deactivated
- Window.IsKeyboardFocusWithinChanged
- Window.IsKeyboardFocusedChanged
- Window.LostKeyboardFocus
- Window.Closed
- Application.Exit
Read more: 2,000 Things You Should Know About WPF
QR: