FrameworkElement.ParentLayoutInvalidated(UIElement) Method


支持 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.

Applies to