How to detect when a ChildWindow modal open/closes application-wide

64 views Asked by At

Our application uses ChildWindow modals all throughout. I am in need of a way to detect when these ChildWindows are being opened and closed in order to do some UI trickery (don't ask and not important).

Alternatively, since the modal ChildWindow "grays out" and disables the app in the background while open, is there someway to hook into that event?

Lately, I've tried GotFocus and LostFocus events on the main LayoutRoot, but it's proven to be erratic. Any ideas would be greatly appreciated.

1

There are 1 answers

0
Mark On

ChildWindow has a Closed event, so you can have some code run when it is closed, e.g.:

var window = new MyChildWindow();
window.Closed += (s, e) => DoSomethingWhenWindowCloses();
window.Show();