Called when the parent of the visual object is changed.
Assembly: PresentationCore (in PresentationCore.dll)
'Declaration Protected Friend Overridable Sub OnVisualParentChanged ( _ oldParent As DependencyObject _ )
A class that derives from Visual can choose to override this method.
There is no "VisualParentChanged" event provided that reports this change to instances. Therefore, you must override this method to handle notification scenarios and provide an instance version of the notification if that is part of your scenario.
The following example defines an overridden implementation of .
Public Class MyVisual Inherits UIElement ' Class member definitions ' ... Protected Overrides Sub OnVisualParentChanged(ByVal oldParent As DependencyObject) ' Perform actions based on OnVisualParentChanged event. ' ... ' Call base class to perform standard event handling. MyBase.OnVisualParentChanged(oldParent) End Sub End Class