[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Occurs when this object is no longer connected to the main object tree.
Assembly: System.Windows (in System.Windows.dll)
XMLNS for XAML: Not mapped to an xmlns.
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 Windows Phone 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.
is raised asynchronously versus the object tree change.
Despite being raised asynchronously, the order in which events are raised from within a contiguous subtree of objects is consistent. 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 event. The first child element of the root raises the next 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 and is traversed, and so on.
Although the event data uses RoutedEventArgs, is not a routed event in Windows Phone.
is not raised for any object if the Windows Phone application shuts down for any reason.
Objects that are being reparented but still remain in the main object tree in the end representation will raise 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 on an object. Similarly, changing the open state of a Popup does not raise on the Popup or any of its child elements.