Reputation: 25927
If I call InvalidateVisual
in my custom WPF control, when does the actual layout evaluation and rendering process happen?
Immediately or - similarly as in WinForms - when I finish my processing?
Upvotes: 4
Views: 5132
Reputation:
The online help answers your question:
Online help for InvalidateVisual:
This method calls InvalidateArrange internally.
Online help for InvalidateArrange:
Invalidates the arrange state (layout) for the element. After the invalidation, the element will have its layout updated, which will occur asynchronously unless subsequently forced by UpdateLayout.
In other words: InvalidateVisual
does not have an effect immediately; it waits until your current code has finished (unless you have calls to UpdateLayout).
You also can look at Microsoft's reference source: http://referencesource.microsoft.com/#q=UIElement.InvalidateArrange . You will see that InvalidateArrange()
does not call any blocking code; it returns immediately.
Upvotes: 5