UIElement.InvalidateMeasure UIElement.InvalidateMeasure UIElement.InvalidateMeasure UIElement.InvalidateMeasure Method

定義

使項目的測量狀態 (配置) 失效。Invalidates the measurement state (layout) for the element.

public:
 void InvalidateMeasure();
public void InvalidateMeasure ();
member this.InvalidateMeasure : unit -> unit
Public Sub InvalidateMeasure ()

備註

呼叫這個方法也呼叫InvalidateArrange就內部而言,就不需要呼叫InvalidateMeasureInvalidateArrange連續。Calling this method also calls InvalidateArrange internally, there is no need to call InvalidateMeasure and InvalidateArrange in succession. 失效之後的項目會有更新,這會以非同步的方式,除非其配置UpdateLayout呼叫以強制變更同步的配置。After the invalidation, the element will have its layout updated, which will occur asynchronously, unless UpdateLayout is called to force a synchronous layout change.

WPF 架構層級配置系統會執行它自己的處理項目的視覺化樹狀結構中的變更,並在最常見的版面配置失效的情況下版面配置系統會呼叫這個方法時所需的對應項。The WPF framework-level layout system does its own handling of changes in the visual tree of an element, and in most common layout invalidation cases the layout system is calling the equivalent of this method when necessary. 如果您要產生完整的版面配置實作,可直接操作或類似的項目樹狀目錄中,進階的案例,才應該呼叫這個方法。You should only call this method if you are producing a complete layout implementation, which does direct manipulation of the element tree, or similar advanced scenarios. 這類進階的案例之一是如果您要建立PropertyChangedCallback不在相依性屬性FreezableFrameworkElement衍生類別,可變更時,仍會影響版面配置的測量傳遞。One such advanced scenario is if you are creating a PropertyChangedCallback for a dependency property that is not on a Freezable or FrameworkElement derived class that still influences the measure pass of layout when it changes.

經常呼叫InvalidateMeasure或在特定UpdateLayout有顯著的效能結果。Frequent calls to InvalidateMeasure or in particular to UpdateLayout have significant performance consequences. 因此,除非您絕對需要精確的配置狀態的其他後續呼叫,呼叫這個方法來避免APIAPIs程式碼中。Therefore, avoid calling this method unless you absolutely require precise layout state for subsequent calls to other APIAPIs in your code.

適用於