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)



先前的父代。The previous parent. 如果 DependencyObject 先前沒有父項目,這可提供為 nullThis may be provided as null if the DependencyObject did not have a parent element previously.

Notes to Inheritors

如果您覆寫這個方法,請一律呼叫基底實作為。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 也會覆寫 OnVisualParentChanged(DependencyObject)UIElement 執行,並 Window 予以密封。FrameworkElement and Window both also override the UIElement implementation of OnVisualParentChanged(DependencyObject), and Window seals it.

Applies to