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 屬性不是在 Freezable FrameworkElement 它變更時仍會影響配置之排列行程的或衍生類別,您可能會呼叫這個案例。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.