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


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

 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事件,例如 mongoadminusernameWindowUserControl,它可能不會呼叫如預期般運作。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