Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6201403
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T04:32:52+00:00 2026-05-24T04:32:52+00:00

When the user clicks the x to close the application window I want to

  • 0

When the user clicks the x to close the application window I want to pop up a message saying “Shutting Down, please wait” and greyout or disable the rest of the window controls.

This is because my application shutdown and cleanup takes a little while, about 20 seconds.

However, wpf commands in the Window_Closing event handler never seem to do anything. I have a tranparent grey-filled border which overlays the window controls and I want to change the visibility from collapsed to visible. The code is called but nothing changes.

It is as if the request is queued but is not called because the window is closing.

Is there some way to flush this request out?

Edit:

Try this code:

private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
    _DisableBorder.Visibility = System.Windows.Visibility.Visible; 
    Thread.Sleep(2000); 
}

The app will close after 2 sec, but the border will never show. If you add e.Cancel = true, then the border will show after 2 sec.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T04:32:52+00:00Added an answer on May 24, 2026 at 4:32 am

    You should make a trick.
    Within the “Closing” handler, you should cancel the closing, then show the popup (as modeless window), then disable everything on the main window. When the process is over, you can close both the popup and the main windows programmatically.

    I’d not perform anything time-consuming within the closing handler.

    Hope it helps.
    Cheers

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to close a System.Windows.Forms.Form if the user clicks anywhere outside it. I've
How do I intercept when the user clicks on a motif window's (widget's) close
I want to catch the close event of my xulrunner app when user clicks
How do I go about changing what happens when a user clicks the close
When a user clicks on the little red x a.k.a. the form close button
Details: Only disable after user clicks the submit button, but before the posting back
When a user clicks a submit button I want the form to be submitted.
I want to wait for and close a modal form (a popup) from another
In my ASP.Net application I have a requirement that when a user clicks on
When a user clicks on an image on a web page, I'd like to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.