1

If i set a owned window like that :

OwnedWindow ownedWindow = new OwnedWindow();
ownedWindow.Owner = this;
ownedWindow.Show();

it' possible to get notificated about the ownedWindow closing?

1 Answer 1

4

Yes.

OwnedWindow ownedWindow = new OwnedWindow();
ownedWindow.Owner = this;
ownedWindow.Closing += new System.ComponentModel.CancelEventHandler(ownedWindow_Closing);
ownedWindow.Show();

This handler should be in owner window.

void ownedWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{

}
2
  • Thanks, it's that i was searching!
    – elCairo
    Jul 13, 2011 at 19:49
  • Resharper tipped me, that you can simplify this: ownedWindow.Closing= ownedWindow_Closing is also accepted
    – RudolfJan
    Sep 29, 2018 at 13:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.