UIElement.IsMeasureValid UIElement.IsMeasureValid UIElement.IsMeasureValid UIElement.IsMeasureValid Property


获取一个值,该值指示布局测量返回的当前大小是否有效。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.


您可以通过对此元素 (或 visual tree 上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 false ,则IsArrangeValid还必须为 (通过执行布局过程的强制逻辑), 并且在未先进行度量的情况下, 排列将是无效的。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).