.NET Framework Class Library
FrameworkElement..::.Unloaded Event

Occurs when the element is removed from within an element tree of loaded elements.

Namespace:  System.Windows
Assembly:  PresentationFramework (in PresentationFramework.dll)
XMLNS for XAML: http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation
Syntax

Visual Basic (Declaration)
Public Event Unloaded As RoutedEventHandler
Visual Basic (Usage)
Dim instance As FrameworkElement
Dim handler As RoutedEventHandler

AddHandler instance.Unloaded, handler
C#
public event RoutedEventHandler Unloaded
Visual C++
public:
 event RoutedEventHandler^ Unloaded {
    void add (RoutedEventHandler^ value);
    void remove (RoutedEventHandler^ value);
}
JScript
JScript does not support events.
XAML Attribute Usage
<object Unloaded="RoutedEventHandler" .../>
Routed Event Information

Identifier field

UnloadedEvent

Routing strategy

Direct

Delegate

RoutedEventHandler

Remarks

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.

Loaded 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 Unloaded cannot be assumed to occur only on navigation away from the page.

Note that the Unloaded event is not raised after an application begins shutting down. Application shutdown occurs when the condition defined by the ShutdownMode property occurs. If you place cleanup code within a handler for the Unloaded event, such as for a Window or a UserControl, it may not be called as expected.

Platforms

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Version Information

.NET Framework

Supported in: 3.5, 3.0
See Also

Reference

Other Resources

Tags :


Page view tracker