UIElement.IsMeasureValid 屬性


取得值,這個值表示配置測量所傳回的目前大小是否有效。Gets a value indicating whether the current size returned by layout measure is valid.

 property bool IsMeasureValid { bool get(); };
public bool IsMeasureValid { get; }
member this.IsMeasureValid : bool
Public ReadOnly Property IsMeasureValid As Boolean



如果配置的測量傳遞傳回有效的目前值則為 true,否則為 falsetrue if the measure pass of layout returned a valid and current value; otherwise, false.


您可以藉由呼叫 InvalidateMeasure 此專案 (或視覺化樹狀結構) 的任何父元素,來強制使測量和排列失效。You can force measurement and arrangement to be invalidated by calling InvalidateMeasure on this element (or any parent element up the visual tree). 這會指定以非同步方式重新組合的版面配置,在版面配置系統所決定的時間發生。This designates the layout for recomposition asynchronously, occurring at a time determined by the layout system. 或者,您可以立即對進行呼叫 UpdateLayoutAlternatively, you could make an immediate call to UpdateLayout. 不過,您應該只在 UpdateLayout 可能沒有任何進一步的失效的情況下呼叫 (有大量非必要的強制更新會) 效能結果。However, you should only call UpdateLayout if it is likely that no further invalidations are pending (a large number of unnecessarily forced updates will have performance consequences).

如果 IsMeasureValidfalse ,則 IsArrangeValid 也必須 false 由配置處理常式的強制邏輯 (,但在沒有測量的情況下,相片順序必須是有效的) 。If IsMeasureValid is false, IsArrangeValid must also be false (by the enforced logic of the layout process, arrangement cannot be valid without measurement first being valid).