UIElement.InvalidateArrange 方法


使項目的排列狀態 (配置) 失效。Invalidates the arrange state (layout) for the element. 失效之後,項目將更新其配置,而且,除非之後由 UpdateLayout() 強制執行,否則這項作業會以非同步方式發生。After the invalidation, the element will have its layout updated, which will occur asynchronously unless subsequently forced by UpdateLayout().

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


經常呼叫 InvalidateArrange 或特別是 UpdateLayout 會對效能造成顯著的影響。Frequent calls to InvalidateArrange or in particular to UpdateLayout have significant performance consequences. 因此,請避免呼叫此方法,除非您在程式碼中對其他 Api 的後續呼叫絕對需要精確的版面配置狀態。Therefore, avoid calling this method unless you absolutely require precise layout state for subsequent calls to other APIs in your code. 您可能會呼叫 InvalidateArrange 的高階案例是,如果您要建立的相依性屬性 PropertyChangedCallback 不在 FreezableFrameworkElement 衍生類別上,但在變更時仍會影響版面配置的排列傳遞。An advanced scenario where you might call InvalidateArrange 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 arrange pass of layout when it changes.