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

備註

當您呼叫這個方法時, 具有IsMeasureValidIsArrangeValid falsefalse專案會呼叫元素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.

適用於

另請參閱