Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to know if window has finished loading?

I am building an app using WPF and I have 2 animations I want to have delay between them. but when I try to that in the

MainWindow_Loaded(object sender, RoutedEventArgs e)

event, it just delays while loading and I miss the 1st animation.

any help?

like image 394
eric.itzhak Avatar asked Feb 02 '26 06:02

eric.itzhak


1 Answers

Maybe worth trying would be to invoke the code with animation using the Dispatcher object. By setting the dispatcher priority you can postpone the execution until for example all data bindings (even asynchronous) are completed.

   // Schedule the update function in the UI thread.
   Dispatcher.BeginInvoke(
      System.Windows.Threading.DispatcherPriority.Loaded, ...);

if this does not work try to change the priority - the lower priority the later your action will be invoked.

like image 174
roberther Avatar answered Feb 03 '26 19:02

roberther