Occurs when the element is laid out, rendered, and ready for interaction.
Assembly: PresentationFramework (in PresentationFramework.dll)
XMLNS for XAML: http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation
is usually the last event raised in an element initialization sequence. It will always be raised after Initialized. Whether you choose to handle or Initialized depends on your requirements. If you do not need to read element properties, intend to reset properties, and do not need any layout information, Initialized might be the better event to act upon. If you need all properties of the element to be available, and you will be setting properties that are likely to reset the layout, might be the better event to act upon. Be careful of reentrancy if your handler resets any properties that are interpreted by the layout system to mean that a new layout pass is required. (You might need to check the FrameworkPropertyMetadata values on the property if you are unsure of which properties can require a new layout pass if they are changed.)
Direct routed events do not follow a route, they are only handled within the same element on which they are raised. Direct routed events do support other routed event behavior: they support an accessible handlers collection, and can be used as an EventTrigger in a style.
and Unloaded might both be raised on controls as a result of user-initiated system theme changes. A theme change causes an invalidation of the control template and the contained visual tree, which in turn causes the entire control to unload and reload. Therefore cannot be assumed to occur only when a page is first loaded through navigation to the page.
This example shows how handle the event, and an appropriate scenario for handling that event. The handler creates a Button when the page loads .
The following example uses Extensible Application Markup Language (XAML) together with a code-behind file.
Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.