Is there a “All Children loaded” event in WPF

后端 未结 7 967
陌清茗
陌清茗 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:19

    One of the options (when content rendered):

    this.LayoutUpdated += OnLayoutUpdated;

    private void OnLayoutUpdated(object sender, EventArgs e)
                {
                    if (!isInitialized && this.ActualWidth != 0 && this.ActualHeight != 0)
                    {
                        isInitialized = true;
                        // Logic here
                    }
                };
    

提交回复
热议问题