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

Property Value


如果布局的测量处理过程返回一个有效的当前值,则为 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).

如果 falseIsMeasureValidIsArrangeValid 还必须 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).

Applies to

See also