Home > Net >  WPF can't cancel the Window is closed
WPF can't cancel the Window is closed

Time:11-08

 
Protected override void OnClosing (CancelEventArgs e)
{
//base. OnClosing (e);
E.c. with our fabrication: ancel=true;
}

Cancel the close event, window was closed

CodePudding user response:

Write your function? There is a problem,
Private void Window_Closing (object sender, System.Com ponentModel CancelEventArgs e)
{
E.c. with our fabrication: ancel=true;
}

CodePudding user response:

The close has been called the will trigger the closing,

CodePudding user response:

refer to 1st floor pan pan pan reply:
your function is written by yourself? There is a problem,
Private void Window_Closing (object sender, System.Com ponentModel CancelEventArgs e)
{
E.c. with our fabrication: ancel=true;
}
I rewrite of the original method

CodePudding user response:

refer to the second floor lonely sea response:
close has been called the will trigger the closing,
are you serious?

CodePudding user response:

reference LQ_DaYuRen reply: 3/f
Quote: refer to 1st floor pan pan pan reply:
your function is written by yourself? There is a problem,
Private void Window_Closing (object sender, System.Com ponentModel CancelEventArgs e)
{
E.c. with our fabrication: ancel=true;
}
I rewrite of the original method



reference LQ_DaYuRen reply: 3/f
Quote: refer to 1st floor pan pan pan reply:
your function is written by yourself? There is a problem,
Private void Window_Closing (object sender, System.Com ponentModel CancelEventArgs e)
{
E.c. with our fabrication: ancel=true;
}
I rewrite of the original method


Writing is no problem, can use, but you should confirm whether have big forms set of small form, other places have shut down,

CodePudding user response:

Not rewrite OnClosing, but Windows. Closing +=(o, e)=& gt; {e.c. with our fabrication: ancel=true; };
  • Related