简体   繁体   中英

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

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.

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM