How can I know from my Silverlight main UserControl (RootVisual) that a ChildWindow is displaying?
Detect from the Application.Current.RootVisual Silverlight ChildWindow opening
916 views Asked by Cornel At
1
How can 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