FrameworkElement.Unloaded Event

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Occurs when this object is no longer connected to the main object tree.

Namespace:  System.Windows
Assembly:  System.Windows (in System.Windows.dll)


Public Event Unloaded As RoutedEventHandler
public event RoutedEventHandler Unloaded
<frameworkElement Unloaded="eventhandler"/>


Use a handler based on RoutedEventHandler to handle this event.

When an object is removed from the main object tree, it is no longer displayed in Silverlight client UI. This can be an appropriate time to remove references that the object makes to other resources. For example, connections that the object makes to Web services might currently be closed.

Unloaded is raised asynchronously versus the object tree change.

Despite being raised asynchronously, the order in which Unloaded events are raised from within a contiguous subtree of objects is consistent. Unloaded events are raised top-down and in the order of placement of peer objects in the run time object tree. The top or root of the subtree raises the first Unloaded event. The first child element of the root raises the next Unloaded event, and then any children and so on. After returning to any level of the object tree where there are peers that have not yet raised the event, that branch's subroot raises Unloaded and is traversed, and so on.

Although the event data uses RoutedEventArgs, Unloaded is not a routed event in Silverlight.

Unloaded is not raised for any object if the Silverlight application shuts down for any reason. This includes cases where the browser host application or out-of-browser window is closed by the user.

Objects that are being reparented but still remain in the main object tree in the end representation will raise Unloaded and then Loaded. This is the case for all objects in a subtree, if a subtree is reparented.

Visibility being set to Visibility.Collapsed is not equivalent to being unloaded from the object tree, and does not raise Unloaded on an object. Similarly, changing the open state of a Popup does not raise Unloaded on the Popup or any of its child elements.

Version Notes

Silverlight 3: This event is not available in Silverlight 3.

Version Information


Supported in: 5, 4

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0


For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.