In WPF, is there a "render complete" event?

wpf example
wpf vs winforms
is wpf dead
wpf download
wpf xaml
wpf framework
wpf net core
wpf tutorial pdf

In WPF, When I load a wrap panel with a lot of elements, the window stalls for a while before showing the content. I would like to add a wait hint but I could not find a way to detect when the wrap panel completes rendering.

I have tried "loaded", "sizechanged", "initialized" without success. Has anyone got any idea on this issue ?

Many thanks !

Yes, use the Window.ContentRendered event.

What is WPF?, WPF, which stands for Windows Presentation Foundation, is Microsoft's latest approach to a GUI framework, used with the . NET framework. NET developers, the most interesting ones are currently WinForms and WPF. WPF is the newest, but Microsoft is still maintaining and supporting WinForms. WPF exists as a subset of .NET types that are (for the most part) located in the System.Windows namespace. If you have previously built applications with .NET using managed technologies like ASP.NET and Windows Forms, the fundamental WPF programming experience should be familiar; you instantiate classes, set properties, call methods, and handle

I know at this point this question is a little old, but I just ran into this same issue and found a great work around and figured this could help someone else in the future. At the start of rendering call Dispatcher.BeginInvoke with the Dispatcher Priority of ContextIdle. My start of rendering just happened to be a treeview selected item change event, but this could be any event that you need to wait for the UI to finish updating.

    private void TreeView_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
        Dispatcher.BeginInvoke(new Action(() => DoSomething()), DispatcherPriority.ContextIdle, null);

    private void DoSomething()
       //This will get called after the UI is complete rendering

What Is WPF, While XAML is used to build user interfaces in WPF, C# is used as the code-​behind languages in WPF. While Windows and their controls are  Windows Presentation Foundation (WPF) is a UI framework that creates desktop client applications. The WPF development platform supports a broad set of application development features, including an application model, resources, controls, graphics, layout, data binding, documents, and security. The framework is part of .NET, so if you have

You can override the OnRender method to detect when rendering is complete.

To push all events call Dispatcher.DoEvents() where DoEvents is implemented as an extension method:

public static class DispatcherExtensions
    public static void DoEvents(this Dispatcher dispatcher, DispatcherPriority priority = DispatcherPriority.Background)
        DispatcherFrame frame = new DispatcherFrame();
        DispatcherOperation dispatcherOperation = dispatcher.BeginInvoke(priority, (Action<DispatcherFrame>)ExitFrame, frame);

       if (dispatcherOperation.Status != DispatcherOperationStatus.Completed)

    private static void ExitFrame(DispatcherFrame frame)
        frame.Continue = false;

    public static void Flush(this Dispatcher dispatcher, DispatcherPriority priority)
        dispatcher.Invoke(()=> { }, priority);


In retrospect I think it's a terrible idea to use this because it can cause hard to solve bugs.

// this shows how bad it is to call Flush or DoEvents
int clicker = 0;
private void OnClick(object sender, RoutedEventArgs e)
    if (clicker != 0)
        // This is reachable... // Could be skipped for DispatcherPriority.Render but then again for render it seems to freeze sometimes.


Is WPF Still Relevant in 2019?, NET Framework versions later, it got improved, and it's still there. In 2019, WPF is in its 13th year which raises the question if WPF is still a good  Windows Presentation Foundation (WPF) has a comprehensive tree structure in the form of objects. In WPF, there are two ways that a complete object tree is conceptualized − Logical Tree Structure; Visual Tree Structure; With the help of these tree structures, you can easily create and identify the relationship between UI elements.

Windows Presentation Foundation, WPF - Overview - WPF stands for Windows Presentation Foundation. It is a powerful framework for building Windows applications. This tutorial explains the  Currently there aren't many real-world application running on WPF. I think that more applications will start appearing next year as more developers and designers get up to speed on WPF develeopment and design. In the meantime, you can check out the Application Portfolio on Channel9 and Tim Sneath's Great WPF Applications list

WPF - Overview, Silverlight employs a smaller subset of the XAML language available in the desktop world, but it is still the same XAML syntax as WPF. In traditional Windows​  For a binding to work, there should be a source object. The selection of source object is totally dependent on the way binding is used. If no binding source is provided, then bydefault DataContext of an element is used. The most common way is to set DataContext on parent element and let it flow to all its children. But apart from this, there

Why Use WPF?, The project is available in Visual Studio after installing .NET Core 3.0 . At this moment, many WPF applications are in production and must be  Unlike traditional HTML with its large range of character entity references, in XML there are only five predefined character entity references. These are used to escape characters that are markup sensitive in certain contexts: &amp; → & (ampersand, U+0026) &lt; → < (less-than sign, U+003C)

  • It's on the same thread so you don't need an event. It finishes when your code reaches line after the line that loads the data.
  • @FCin Thank you. But it acts not like that. After loading e.g, 200 elements in the wrappanel, the code-behind returns, the window stalls, and it takes about 1~2 seconds before the window gets back to life again.
  • Probably binding is still happening, You can check if the thread is ApplicationIdle to tell when the processing is done.
  • Handle the Loaded event of the last element in the WrapPanel?
  • This seems to be a massive bug in WPF. You can change the DispatcherPriority of UI rendering so that it does lazy loading and doesn't lock the screen up, but if you do this, there is no way to know when the UI has completed rendering.
  • Didn't know that one. nice!