Detect from the Application.Current.RootVisual Silverlight ChildWindow opening

931 views Asked by At

How can I know from my Silverlight main UserControl (RootVisual) that a ChildWindow is displaying?

1

There are 1 answers

0
Alan Jones On

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