UIElement.UpdateLayout UIElement.UpdateLayout UIElement.UpdateLayout UIElement.UpdateLayout Method

定义

请确保此元素的所有可视子元素都正确地进行了布局更新。Ensures that all visual child elements of this element are properly updated for layout.

public:
 void UpdateLayout();
public void UpdateLayout ();
member this.UpdateLayout : unit -> unit
Public Sub UpdateLayout ()

注解

调用此方法时IsMeasureValid , 具有falseIsArrangeValid false的元素将调用元素特定MeasureCore的和ArrangeCore方法, 这会强制执行布局更新, 并验证所有计算的大小。When you call this method, elements with IsMeasureValidfalse or IsArrangeValidfalse will call element-specific MeasureCore and ArrangeCore methods, which forces layout update, and all computed sizes will be validated.

如果布局没有变化, 或者布局的排列和度量状态均无效, 则调用此方法将不起作用。Calling this method has no effect if layout is unchanged, or if neither arrangement nor measurement state of a layout is invalid. 但是, 如果布局在任何一个方面无效, 则UpdateLayout调用将重做整个布局。However, if layout is invalid in either respect, the UpdateLayout call will redo the entire layout. 因此, 应避免在元素UpdateLayout树中的每次增量更改和次要更改之后调用。Therefore, you should avoid calling UpdateLayout after each incremental and minor change in the element tree. 布局系统将使用一种算法来以延迟方式执行元素布局, 并使用一种算法来平衡性能和货币, 并使用加权策略来将更改延迟到所有子元素有效。The layout system will perform element layout in a deferred manner, using an algorithm that balances performance and currency, and with a weighting strategy to defer changes to roots until all child elements are valid. 仅当你确实UpdateLayout需要更新的大小和位置, 并且仅在你确定控制和可能影响布局的所有属性更改完成后, 才应调用。You should only call UpdateLayout if you absolutely need updated sizes and positions, and only after you are certain that all changes to properties that you control and that may affect layout are completed.

适用于

另请参阅