UIElement.InvalidateVisual UIElement.InvalidateVisual UIElement.InvalidateVisual UIElement.InvalidateVisual Method


讓項目的呈現失效,並強制全新的配置傳遞。Invalidates the rendering of the element, and forces a complete new layout pass. 完成配置循環之後,會呼叫 OnRender(DrawingContext)OnRender(DrawingContext) is called after the layout cycle is completed.

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


這個方法會呼叫InvalidateArrange內部。This method calls InvalidateArrange internally.

從您的應用程式程式碼不通常呼叫這個方法。This method is not generally called from your application code. WPF 架構層級配置系統它自己的變更項目的視覺化樹狀結構中的處理作業,並會呼叫這個方法時所需的對等項目已經。The WPF framework-level layout system does its own handling of changes in the visual tree of an element, and would be calling the equivalent of this method when necessary already. 呼叫這個方法就只需要進階的案例。Calling this method is necessary only for 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 layout when it changes.