在Grid.Children.Add上引发什么事件 [英] What event is raised on Grid.Children.Add

查看:385
本文介绍了在Grid.Children.Add上引发什么事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的WPF应用程序中,我有一个包含网格的主窗口.我有一个登录名和一个Shell用户控件,它们被设置为Grid Children.

我想在添加Shell时(即用户登录时)在主窗口中启动一个计时器.我需要使用Grid.Children.Add方法来了解将子级添加到网格时,甚至会引发什么. .

In my WPF app, I have a main window containing a grid. I have a Login and a Shell User Control which are set as the Grid Children.

I want to start a timer in the main wondow on addition of the Shell, i.e. when the user logs in. I need to know as to what even is raised when a child is added to a grid, using the Grid.Children.Add method.

推荐答案

您可以覆盖
You could possibly override Grid.OnVisualChildrenChanged[^] and run the necessary code in there.

Just remember to call the base method also!


这篇关于在Grid.Children.Add上引发什么事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆