UIElement.OnVisualParentChanged(DependencyObject) UIElement.OnVisualParentChanged(DependencyObject) UIElement.OnVisualParentChanged(DependencyObject) UIElement.OnVisualParentChanged(DependencyObject) Method

定义

在此 UIElement 的父元素报告其基础可视父元素发生更改时,调用此方法。Invoked when the parent element of this UIElement reports a change to its underlying visual parent.

protected public:
 override void OnVisualParentChanged(System::Windows::DependencyObject ^ oldParent);
protected internal override void OnVisualParentChanged (System.Windows.DependencyObject oldParent);
override this.OnVisualParentChanged : System.Windows.DependencyObject -> unit
Protected Friend Overrides Sub OnVisualParentChanged (oldParent As DependencyObject)

参数

oldParent
DependencyObject DependencyObject DependencyObject DependencyObject

先前的父项。The previous parent. 如果 DependencyObject 先前不具有父元素,则此项可以提供为 nullThis may be provided as null if the DependencyObject did not have a parent element previously.

继承者说明

如果重写此方法, 请始终调用基实现。If you override this method, always call the base implementation. 默认基实现对反向继承属性状态执行一些内部维护。The default base implementation performs some internal maintenance of reverse-inherited property state. 未能调用基实现将使此状态失效。Failing to call the base implementation will invalidate this state.

此方法重写 OnVisualParentChanged(DependencyObject)This method overrides OnVisualParentChanged(DependencyObject). FrameworkElement同时, UIElement OnVisualParentChanged(DependencyObject) Window两者还会重写的实现, 并将其密封。 WindowFrameworkElement and Window both also override the UIElement implementation of OnVisualParentChanged(DependencyObject), and Window seals it.

适用于