Dela via


UIElement.InvalidateMeasure Method

Definition

Invalidates the measurement state (layout) for a UIElement.

public:
 virtual void InvalidateMeasure() = InvalidateMeasure;
void InvalidateMeasure();
public void InvalidateMeasure();
function invalidateMeasure()
Public Sub InvalidateMeasure ()

Remarks

UpdateLayout is basically equivalent to calling InvalidateMeasure and InvalidateArrange in sequence.

Layout updates can be forced by app code rather than relying on the built-in layout system behavior. However, that is not generally recommended. Calling InvalidateArrange, InvalidateMeasure or UpdateLayout is usually unnecessary and can cause poor performance if overused. In many situations where app code might be changing layout properties, the layout system will probably already be processing updates asynchronously. The layout system also has optimizations for dealing with cascades of layout changes through parent-child relationships, and forcing layout with app code can work against such optimizations. Nevertheless, it's possible that layout situations exist in more complicated scenarios where forcing layout is the best option for resolving a timing issue or other issue with layout. Just use it deliberately and sparingly.

Applies to

See also