开发者

Detect from the Application.Current.RootVisual Silverlight ChildWindow opening

开发者 https://www.devze.com 2023-02-11 08:28 出处:网络
How c开发者_如何学Pythonan I know from my Silverlight main UserControl (RootVisual) that a ChildWindow is displaying?Not sure if there\'s any way more specific than setting up the wiring yourself.

How c开发者_如何学Pythonan I know from my Silverlight main UserControl (RootVisual) that a ChildWindow is displaying?


Not sure if there's any way more specific than setting up the wiring yourself.

1) You would want to make a public singleton class (ie. ChildWindowManager) that contains an event called OnChildWindowShowing. Your root visual would then subscribe to that event.

2) In order to make that event fire at proper times, you need to set up some wiring on your ChildWindow instances. You can do this on a case by case basis, or you can make a class that inherits from ChildWindow and has custom constructor. But you need to set events on the ChildWindow that would cause OnChildWindowShowing event on the singleton class we created before to fire.

So conceptually it would look something like: ChildWindow.OnShow() <--> ChildWindowManager.OnChildWindowShowing <--> RootVisual

0

精彩评论

暂无评论...
验证码 换一张
取 消