FrameworkElement.ParentLayoutInvalidated(UIElement) 方法


FrameworkElement 的特定子類別中支援累加配置實作。Supports incremental layout implementations in specialized subclasses of FrameworkElement. ParentLayoutInvalidated(UIElement) 會在子項目使得屬性失效時叫用,該屬性在中繼資料內已標記,會在配置期間影響父代的測量或排列傳遞。ParentLayoutInvalidated(UIElement) is invoked when a child element has invalidated a property that is marked in metadata as affecting the parent's measure or arrange passes during layout.

protected public:
 virtual void ParentLayoutInvalidated(System::Windows::UIElement ^ child);
protected internal virtual void ParentLayoutInvalidated (System.Windows.UIElement child);
abstract member ParentLayoutInvalidated : System.Windows.UIElement -> unit
override this.ParentLayoutInvalidated : System.Windows.UIElement -> unit
Protected Friend Overridable Sub ParentLayoutInvalidated (child As UIElement)



報告變更的子項目。The child element reporting the change.


如果這個元素有一個子項目,其中某些屬性已失效,而且在註冊期間將屬性標記為 AffectsParentMeasureAffectsParentArrange 在屬性中繼資料中,則會叫用這個方法。If this element has a child element on which some property was invalidated and the property was marked as AffectsParentMeasure or AffectsParentArrange in property metadata during registration, this method is invoked. 如果這個元素支援配置的部分 (累加) 更新,方法叫用會通知父元素必須重新測量的特定子專案。The method invocation notifies the parent element which particular child element must be re-measured if this element supports partial (incremental) update of layout.

依預設,不支援累加配置 FrameworkElement ,而且在類別中, FrameworkElement 這個方法沒有預設的實值。By default, FrameworkElement does not support incremental layout, and in the FrameworkElement class this method has no default implementation. 需要覆寫這個方法的情況並不常見,因為它需要您修改預設的版面配置系統行為。The scenario where overriding this method would be necessary is not common, because it requires you to modify the default layout system behavior.

假設某個類別具有可能子專案的類型限制,而這些專案的限制比 WPF 架構層級的版面配置系統大得多,就可能會發生此情況。An example implementation scenario might be if a class had type limitations for possible child elements that are significantly more restrictive than the WPF framework-level layout system. 由於這些自訂元素的本質,因此當您執行一些自訂的版面配置行為時,可能會刻意延遲屬性變更。Because of the nature of these custom elements, property changes could be deliberately deferred when you implement some custom layout behavior. 比方說,量值/排列方法覆寫(嘗試優化子項目轉譯行程)可以延後至某些變更類型,而這些變更通常會導致另一個版面配置傳遞。For instance, measure/arrange method overrides, which try to optimize the child element render pass, could be deferred for certain types of changes that would ordinarily result in another layout pass.