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). FrameworkElementWindow同時也會覆寫UIElement實作OnVisualParentChanged(DependencyObject),和Window密封它。FrameworkElement and Window both also override the UIElement implementation of OnVisualParentChanged(DependencyObject), and Window seals it.

適用於