Is there a “All Children loaded” event in WPF

后端 未结 7 949
陌清茗
陌清茗 2020-12-13 02:49

I am listening for the loaded event of a Page. That event fires first and then all the children fire their load event. I need an event that fires when ALL the children have

7条回答
  •  既然无缘
    2020-12-13 03:23

    I hear you. I also am missing an out of the box solution in WPF for this.

    Sometimes you want some code to be executed after all the child controls are loaded.

    Put this in the constructor of the parent control

    Dispatcher.BeginInvoke(DispatcherPriority.Loaded, new Action(() => {code that should be executed after all children are loaded} ));
    

    Helped me a few times till now.

提交回复
热议问题