#616 – FrameworkElement.Initialized and Loaded Event Order

All elements that inherit (directly or indirectly) from FrameworkElement will fire both Initialized and Loaded events when the control is being loaded.  For example, both an Initialized and Loaded event will for each control in your application when the application is starting up.

The Initialized events for all controls fire starting with the elements at the bottom of the logical tree.  When handling the Initialize event for a particular element, you can assume that any elements below the element in question have already been initialized.

The Loaded event, on the other hand, fires from the top of the logical tree and then continues down the tree.  The Loaded events begin firing only after the layout system has figured out the position and size of every element in the tree.  So in a handler for a Loaded event, you can assume that all elements in the logical tree are fully configured.

Advertisements