Much like when clicking buttons that raise an event, Windows have their own events that can be raised if we specify they should. The link below has a list of events that belong to the Window class.
What we are most interested in, however, is the Loaded event. In the past we have always manually clicked a button to initialize objects, but this isn't necessary. We can raise an event when the Window loads that does this for us.