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 ()

備註

當您呼叫此方法中,使用的項目IsMeasureValidfalse或是IsArrangeValidfalse會呼叫項目專用MeasureCoreArrangeCore方法,這會強制版面配置更新,且會驗證所有的計算的大小。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.

適用於

另請參閱