♣ WPF window life time contains following phases
1. Instantiation
2. Open
3. Activate
4. De-Activate
5. Close
Instantiation :
♣ It is starting phase of Window
Open :
♣ When window is open, then it will enter in to 2nd phase
♣ Window can open because of app.xaml or by using show()
Activate :
♣ When window is opened, automatically it will become active, the active window is the window which is currently accepting the user input.
♣ When a window becomes active it raises the activated event
♣ To activate the window programmatically, we can use a method called activate()
De-Activate :
♣ There is no predefined method to deactivate the window programmatically
♣ When control switches from current window to other window then current window will became de active
♣ Using window.IsActive property we can check whether the window is activated or not
♣ IsActive is a Boolean property, it will return true when the window is activated, otherwise it will return false
Close :
♣ The life cycle of window comes to end by closing the window.
♣ If you want to close the window programmatically we can use close() method
♣ When a window is closed object of the concern window class will be destroyed
♣ When a window closes it raises two events
1. Closing
2. Closed
Closing :
♣ Closing is raised before close the window
♣ In this event we can write some code to prevent to close the window
Closed :
♣ Closed event is fired after closing the event and just before window actually closed
♣ At this point a window can not be prevented from closing