开发者

Cancel Silverlight OOB Application Exit?

When the user closes my application I'd like to be able to prompt them with a confirmation if they have unsaved changes, and cancel the application's closing if they indicate to do so. The Application's Ex开发者_如何学JAVAit event does not allow cancellation. Is there any way to do this?


Catch the Closing event of the MainWindow instead:

App.Current.MainWindow.Closing += MainWindow_Closing;

Then you can set the Cancel property to true in the event handler if necessary:

private void MainWindow_Closing(object sender, System.ComponentModel.ClosingEventArgs e)
{
    e.Cancel = true;
}

Hope this helps...

Chris

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜