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.


如果這個專案具有子專案,其中某些屬性已失效,且屬性在註冊期間已標記為 AffectsParentMeasure 或在屬性中繼資料中 AffectsParentArrange,則會叫用這個方法。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.