FrameworkElement.Unloaded FrameworkElement.Unloaded FrameworkElement.Unloaded FrameworkElement.Unloaded Event

定義

當項目從已載入項目的項目樹狀結構中移除時發生。Occurs when the element is removed from within an element tree of loaded elements.

public:
 event System::Windows::RoutedEventHandler ^ Unloaded;
public event System.Windows.RoutedEventHandler Unloaded;
member this.Unloaded : System.Windows.RoutedEventHandler 
Public Custom Event Unloaded As RoutedEventHandler 

備註

直接路由事件不會遵循路由, 只會在引發它們的相同專案中處理。Direct routed events do not follow a route, they are only handled within the same element on which they are raised. 直接路由事件支援其他路由事件行為: 它們支援可存取的處理常式集合, 而且可以用來做EventTrigger為樣式中的。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.

LoadedUnloaded使用者起始的系統主題變更時, 可能會在控制項上引發和。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. 因此Unloaded , 無法假設為只在流覽離開頁面時才會發生。Therefore Unloaded cannot be assumed to occur only on navigation away from the page.

請注意, Unloaded在應用程式開始關閉之後, 不會引發事件。Note that the Unloaded event is not raised after an application begins shutting down. ShutdownMode屬性所定義的條件發生時, 就會發生應用程式關閉。Application shutdown occurs when the condition defined by the ShutdownMode property occurs. 如果您將清除程式碼放在Unloaded事件Window的處理常式中 (例如或UserControl), 則可能不會如預期般呼叫。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.

路由事件資訊Routed Event Information

識別碼欄位Identifier field UnloadedEvent
路由策略Routing strategy 直接Direct
Delegate - 委派Delegate RoutedEventHandler

適用於

另請參閱