This documentation is archived and is not being maintained.

FrameworkElement.Initialized Event

Occurs when this FrameworkElement is initialized. This event coincides with cases where the value of the IsInitialized property changes from false (or undefined) to true.

Namespace: System.Windows
Assembly: PresentationFramework (in presentationframework.dll)
XML Namespace:  http://schemas.microsoft.com/winfx/2006/xaml/presentation

public event EventHandler Initialized
/** @event */
public void add_Initialized (EventHandler value)

/** @event */
public void remove_Initialized (EventHandler value)

In JScript, you can handle the events defined by a class, but you cannot define your own.
<object Initialized="EventHandler" .../>

This event will be raised whenever the EndInit or OnVisualParentChanged methods are called. Calls to either method could have come from application code, or through the Extensible Application Markup Language (XAML) reader behavior when a XAML page is parsed or loaded.

Whether you choose to handle Loaded 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, Loaded 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.)

For more information about the sequence of object events for a FrameworkElement, and also for several related application and element classes, see Object Lifetime Events.

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0
Show: