PresentationSource.RootChanged(Visual, Visual) Method

Definition

Provides notification that the root Visual has changed.

C#
[System.Security.SecurityCritical]
[System.Security.SecurityTreatAsSafe]
protected void RootChanged(System.Windows.Media.Visual oldRoot, System.Windows.Media.Visual newRoot);
C#
protected void RootChanged(System.Windows.Media.Visual oldRoot, System.Windows.Media.Visual newRoot);

Parameters

oldRoot
Visual

The old root Visual.

newRoot
Visual

The new root Visual.

Attributes

Remarks

Derived classes should call this method to indicate that their root Visual has changed.

Calling this method causes two object lifetime events to be raised on the specified root visuals, if and only if those root visuals are FrameworkElement derived classes.

  • The old root visual will raise the Unloaded event, and will process its tree of elements downward, broadcasting this event to each child element.

  • The new root visual will raise the Loaded event, and will process its tree of elements downward, broadcasting this event to each child element.

Applies to

Product Versions
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10