PresentationSource.RootChanged(Visual, Visual) 方法

定義

提供告知,指出根 Visual 已變更。

protected:
 void RootChanged(System::Windows::Media::Visual ^ oldRoot, System::Windows::Media::Visual ^ newRoot);
[System.Security.SecurityCritical]
[System.Security.SecurityTreatAsSafe]
protected void RootChanged (System.Windows.Media.Visual oldRoot, System.Windows.Media.Visual newRoot);
protected void RootChanged (System.Windows.Media.Visual oldRoot, System.Windows.Media.Visual newRoot);
[<System.Security.SecurityCritical>]
[<System.Security.SecurityTreatAsSafe>]
member this.RootChanged : System.Windows.Media.Visual * System.Windows.Media.Visual -> unit
member this.RootChanged : System.Windows.Media.Visual * System.Windows.Media.Visual -> unit
Protected Sub RootChanged (oldRoot As Visual, newRoot As Visual)

參數

oldRoot
Visual

舊的根 Visual

newRoot
Visual

新的根 Visual

屬性

備註

衍生類別應該呼叫這個方法,以指出其根 Visual 目錄已變更。

呼叫這個方法會導致在指定的根視覺效果上引發兩個物件存留期事件,只有在這些根視覺效果是 FrameworkElement 衍生類別時,才會引發。

  • 舊的根視覺效果會引發 Unloaded 事件,並將其專案樹狀結構向下處理,並將此事件廣播至每個子項目。

  • 新的根視覺效果會引發 Loaded 事件,並將其專案樹狀結構向下處理,並將此事件廣播至每個子項目。

適用於