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

  • Home
  • SEARCH
  • 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 4079078
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T17:45:19+00:00 2026-05-20T17:45:19+00:00

Goal: Enable closing of the application’s window(s) independently without affecting others. The application is

  • 0

Goal:
Enable closing of the application’s window(s) independently without affecting others. The application is created in WPF.

Problem:

Can’t close the window(s)

In winform, it is enough to have the code winform.close() to close down the window but it doesn’t work in WPF.

You can have this code to close a specfic window:

Application.Current.Windows[0].Close(); 

but how would it work if you have many windows and you want to close a specific window without affecting the others?

  • 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-20T17:45:20+00:00Added an answer on May 20, 2026 at 5:45 pm

    Use the Application class to get the windows through Application.Windows-property exactly as you described. If you are in the code-behind of the window, call this.Close();

    Configuration for multiple Windows
    Set the main window to the Application.MainWindow property and set the Application.ShutdownMode to a appropriate value if you also want to hold the app open, if the main window is closed (e.g App.Current.ShutdownMode=ShutdownMode.OnExplicitShutdown; ).

    I have already observed, that some people have had problems with the ShutdownMode. A workaround for this is to open the first window invisible and from this window, you open the visible application windows. This prevents the application from closing if the first created window will be closed. However you should be able to resolve this problem also over the ShutdownMode-property.
    In scenarios with multiple windows, you can use Shutdown to close the app without closing every window.

    I hope this answer is what your question is about. Make a comment if not.

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

Sidebar

Related Questions

Goal : I wants when I drag image it become fade so we can
Goal: Gain datatype date with year and month Problem: Need to help to convert
Thrift's primary goal is to enable efficient and reliable communication across programming languages. but
I'm trying to enable a web application I've written in ASP.NET MVC2 to be
I am using ASP.NET MVC to develop an application framework. Essentially, the end goal
Goal: Having two buttons that should be enable to add or delete data from
I have a WPF application where the user enters database information in some textboxes.
Goal is to make a dialog that appears on menu_key pressed, but it keeps
Goal: Once i click on the start button on my user interface, i currently
Goal: Produce an Excel document with information from 3 associated models that is similar

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.