c# - How to know if Window Close was completed or cancelled? -
wpf application. window1 can open windowa.show(), windowb.show(), windowc.show()
when close window1 want close open windows (a, b , c).
on window1_closing
event call
windowa.close(); windowb.close(); windowc.close();
on window closing of of these cancel = true can called , windowa (or b or c) won't close. don't want close window1 (the parent). how know in window1_closing
if of child windows cancelled (not closed)?
window.closed
event fired after window closed. either move logic eventhandler of closed event, or use event send flag:bool isclosed = false; windowa.closed += delegate { isclosed = true; }; windowa.close(); if (isclosed) { }
application.current.windows
collection of opened windows:windowa.close(); bool isclosed = !application.current.windows.oftype<window>().contains(windowa);
Comments
Post a Comment